home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 June: Reference Library / Dev.CD Jun 96 RL / Dev.CD Jun 96 RL.toast / Technical Documentation / develop / develop Issue 11 / develop Issue 11 code / MultiBuffer.sea / MultiBuffer / MultiBuffer Source / MainApp.c < prev    next >
MacBinary  |  1992-07-15  |  18.3 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
1% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Jul 15 15:24:29 1992, modified Wed Jul 15 15:24:29 1992, creator 'MPS ', type ASCII, 17612 bytes "MainApp.c" , at 0x454c 866 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% dearkID deark: macbinary default
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 4d 61 69 6e 41 70 | 70 2e 63 00 00 00 00 00 |..MainAp|p.c.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 44 cc 00 | 00 03 62 a6 8a 2b ed a6 |.....D..|..b..+..|
|00000060| 8a 2b ed 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.+......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b1 83 00 00 |........|........|
|00000080| 0d 23 70 72 61 67 6d 61 | 20 6c 6f 61 64 20 22 4d |.#pragma| load "M|
|00000090| 61 63 48 65 61 64 65 72 | 73 22 0d 0d 0d 23 69 66 |acHeader|s"...#if|
|000000a0| 6e 64 65 66 20 5f 5f 4d | 41 49 4e 49 4e 43 4c 55 |ndef __M|AININCLU|
|000000b0| 44 45 53 5f 5f 0d 23 69 | 6e 63 6c 75 64 65 20 22 |DES__.#i|nclude "|
|000000c0| 4d 61 69 6e 41 70 70 2e | 68 22 0d 23 65 6e 64 69 |MainApp.|h".#endi|
|000000d0| 66 0d 0d 0d 2f 2f 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |f...//~~|~~~~~~~~|
|000000e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000000f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000100| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000110| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000120| 7e 7e 7e 7e 7e 7e 0d 2f | 2f 20 54 68 65 20 22 67 |~~~~~~./|/ The "g|
|00000130| 22 20 70 72 65 66 69 78 | 20 69 73 20 75 73 65 64 |" prefix| is used|
|00000140| 20 74 6f 20 65 6d 70 68 | 61 73 69 7a 65 20 74 68 | to emph|asize th|
|00000150| 61 74 20 61 20 76 61 72 | 69 61 62 6c 65 20 69 73 |at a var|iable is|
|00000160| 20 67 6c 6f 62 61 6c 2e | 0d 0d 2f 2f 09 67 49 6e | global.|..//.gIn|
|00000170| 42 61 63 6b 67 72 6f 75 | 6e 64 20 69 73 20 6d 61 |Backgrou|nd is ma|
|00000180| 69 6e 74 61 69 6e 65 64 | 20 62 79 20 6f 75 72 20 |intained| by our |
|00000190| 4f 53 45 76 65 6e 74 20 | 68 61 6e 64 6c 69 6e 67 |OSEvent |handling|
|000001a0| 20 72 6f 75 74 69 6e 65 | 73 2e 20 41 6e 79 20 70 | routine|s. Any p|
|000001b0| 61 72 74 20 6f 66 0d 2f | 2f 09 74 68 65 20 70 72 |art of./|/.the pr|
|000001c0| 6f 67 72 61 6d 20 63 61 | 6e 20 63 68 65 63 6b 20 |ogram ca|n check |
|000001d0| 69 74 20 74 6f 20 66 69 | 6e 64 20 6f 75 74 20 69 |it to fi|nd out i|
|000001e0| 66 20 69 74 20 69 73 20 | 63 75 72 72 65 6e 74 6c |f it is |currentl|
|000001f0| 79 20 69 6e 20 74 68 65 | 20 62 61 63 6b 67 72 6f |y in the| backgro|
|00000200| 75 6e 64 2e 0d 42 6f 6f | 6c 65 61 6e 09 09 09 67 |und..Boo|lean...g|
|00000210| 49 6e 42 61 63 6b 67 72 | 6f 75 6e 64 3b 09 09 2f |InBackgr|ound;../|
|00000220| 2f 20 6d 61 69 6e 74 61 | 69 6e 65 64 20 62 79 20 |/ mainta|ined by |
|00000230| 49 6e 69 74 69 61 6c 69 | 7a 65 20 61 6e 64 20 44 |Initiali|ze and D|
|00000240| 6f 45 76 65 6e 74 0d 0d | 2f 2f 09 67 41 6d 70 6c |oEvent..|//.gAmpl|
|00000250| 69 74 75 64 65 20 61 6e | 64 20 67 50 69 74 63 68 |itude an|d gPitch|
|00000260| 20 61 72 65 20 63 6f 6d | 70 75 74 65 64 20 66 72 | are com|puted fr|
|00000270| 6f 6d 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 73 |om the c|urrent s|
|00000280| 74 61 74 65 20 6f 66 20 | 74 68 65 20 73 6c 69 64 |tate of |the slid|
|00000290| 65 72 73 20 69 6e 0d 2f | 2f 09 74 68 65 20 6d 61 |ers in./|/.the ma|
|000002a0| 69 6e 20 61 70 70 20 77 | 69 6e 64 6f 77 2e 0d 75 |in app w|indow..u|
|000002b0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 09 67 41 6d |nsigned |char.gAm|
|000002c0| 70 6c 69 74 75 64 65 3b | 0d 75 6e 73 69 67 6e 65 |plitude;|.unsigne|
|000002d0| 64 20 73 68 6f 72 74 09 | 67 50 69 74 63 68 3b 0d |d short.|gPitch;.|
|000002e0| 42 6f 6f 6c 65 61 6e 09 | 09 09 67 55 70 64 61 74 |Boolean.|..gUpdat|
|000002f0| 65 57 61 76 65 3b 0d 0d | 2f 2f 09 67 50 72 69 76 |eWave;..|//.gPriv|
|00000300| 61 74 65 50 74 72 20 67 | 69 76 65 73 20 75 73 20 |atePtr g|ives us |
|00000310| 61 20 70 74 72 20 74 6f | 20 4d 75 6c 74 69 42 75 |a ptr to| MultiBu|
|00000320| 66 66 65 72 27 73 20 70 | 72 69 76 61 74 65 20 6d |ffer's p|rivate m|
|00000330| 65 6d 6f 72 79 2c 20 73 | 6f 20 77 65 20 63 61 6e |emory, s|o we can|
|00000340| 20 64 69 73 70 6f 73 65 | 20 6f 66 20 69 74 0d 2f | dispose| of it./|
|00000350| 2f 09 77 68 65 6e 20 74 | 68 65 20 70 6c 61 79 20 |/.when t|he play |
|00000360| 69 73 20 66 69 6e 69 73 | 68 65 64 2e 0d 50 74 72 |is finis|hed..Ptr|
|00000370| 09 09 09 09 67 50 72 69 | 76 61 74 65 50 74 72 3b |....gPri|vatePtr;|
|00000380| 0d 0d 0d 0d 0d 2f 2f 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.....//~|~~~~~~~~|
|00000390| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000003a0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000003b0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000003c0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000003d0| 7e 7e 7e 7e 7e 7e 7e 0d | 2f 2f 20 70 72 6f 74 6f |~~~~~~~.|// proto|
|000003e0| 74 79 70 65 73 0d 0d 76 | 6f 69 64 09 09 6d 61 69 |types..v|oid..mai|
|000003f0| 6e 28 76 6f 69 64 29 3b | 0d 76 6f 69 64 09 09 45 |n(void);|.void..E|
|00000400| 76 65 6e 74 4c 6f 6f 70 | 28 76 6f 69 64 29 3b 0d |ventLoop|(void);.|
|00000410| 76 6f 69 64 09 09 44 6f | 45 76 65 6e 74 28 45 76 |void..Do|Event(Ev|
|00000420| 65 6e 74 52 65 63 6f 72 | 64 20 2a 65 76 65 6e 74 |entRecor|d *event|
|00000430| 29 3b 0d 76 6f 69 64 09 | 09 44 6f 55 70 64 61 74 |);.void.|.DoUpdat|
|00000440| 65 28 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |e(Window|Ptr wind|
|00000450| 6f 77 29 3b 0d 76 6f 69 | 64 09 09 44 6f 41 63 74 |ow);.voi|d..DoAct|
|00000460| 69 76 61 74 65 28 57 69 | 6e 64 6f 77 50 74 72 20 |ivate(Wi|ndowPtr |
|00000470| 77 69 6e 64 6f 77 2c 20 | 42 6f 6f 6c 65 61 6e 20 |window, |Boolean |
|00000480| 62 65 63 6f 6d 69 6e 67 | 41 63 74 69 76 65 29 3b |becoming|Active);|
|00000490| 0d 76 6f 69 64 09 09 44 | 6f 43 6f 6e 74 65 6e 74 |.void..D|oContent|
|000004a0| 43 6c 69 63 6b 28 57 69 | 6e 64 6f 77 50 74 72 20 |Click(Wi|ndowPtr |
|000004b0| 77 69 6e 64 6f 77 2c 20 | 45 76 65 6e 74 52 65 63 |window, |EventRec|
|000004c0| 6f 72 64 20 2a 65 76 65 | 6e 74 29 3b 0d 76 6f 69 |ord *eve|nt);.voi|
|000004d0| 64 09 09 41 64 6a 75 73 | 74 4d 65 6e 75 73 28 76 |d..Adjus|tMenus(v|
|000004e0| 6f 69 64 29 3b 0d 76 6f | 69 64 09 09 44 6f 4d 65 |oid);.vo|id..DoMe|
|000004f0| 6e 75 43 6f 6d 6d 61 6e | 64 28 6c 6f 6e 67 20 6d |nuComman|d(long m|
|00000500| 65 6e 75 52 65 73 75 6c | 74 29 3b 0d 76 6f 69 64 |enuResul|t);.void|
|00000510| 09 09 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 28 |..DoClos|eWindow(|
|00000520| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window|
|00000530| 29 3b 0d 76 6f 69 64 09 | 09 54 65 72 6d 69 6e 61 |);.void.|.Termina|
|00000540| 74 65 28 76 6f 69 64 29 | 3b 0d 76 6f 69 64 09 09 |te(void)|;.void..|
|00000550| 49 6e 69 74 69 61 6c 69 | 7a 65 28 76 6f 69 64 29 |Initiali|ze(void)|
|00000560| 3b 0d 42 6f 6f 6c 65 61 | 6e 09 09 49 73 44 41 57 |;.Boolea|n..IsDAW|
|00000570| 69 6e 64 6f 77 28 57 69 | 6e 64 6f 77 50 74 72 20 |indow(Wi|ndowPtr |
|00000580| 77 69 6e 64 6f 77 29 3b | 0d 6c 6f 6e 67 09 09 47 |window);|.long..G|
|00000590| 65 74 53 6c 65 65 70 28 | 76 6f 69 64 29 3b 0d 76 |etSleep(|void);.v|
|000005a0| 6f 69 64 09 09 44 6f 49 | 64 6c 65 28 76 6f 69 64 |oid..DoI|dle(void|
|000005b0| 29 3b 0d 42 6f 6f 6c 65 | 61 6e 09 09 46 61 69 6c |);.Boole|an..Fail|
|000005c0| 4c 6f 77 4d 65 6d 6f 72 | 79 28 6c 6f 6e 67 20 6d |LowMemor|y(long m|
|000005d0| 65 6d 52 65 71 75 65 73 | 74 65 64 29 3b 0d 76 6f |emReques|ted);.vo|
|000005e0| 69 64 09 09 41 6c 65 72 | 74 55 73 65 72 28 73 68 |id..Aler|tUser(sh|
|000005f0| 6f 72 74 20 65 72 72 4e | 75 6d 2c 20 73 68 6f 72 |ort errN|um, shor|
|00000600| 74 20 65 72 72 53 74 72 | 49 6e 64 65 78 2c 20 42 |t errStr|Index, B|
|00000610| 6f 6f 6c 65 61 6e 20 66 | 61 74 61 6c 29 3b 0d 76 |oolean f|atal);.v|
|00000620| 6f 69 64 09 09 4e 65 77 | 4d 61 69 6e 57 69 6e 64 |oid..New|MainWind|
|00000630| 6f 77 28 76 6f 69 64 29 | 3b 0d 76 6f 69 64 09 09 |ow(void)|;.void..|
|00000640| 44 72 61 77 4d 61 69 6e | 57 69 6e 64 6f 77 28 57 |DrawMain|Window(W|
|00000650| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 29 |indowPtr| window)|
|00000660| 3b 0d 76 6f 69 64 09 09 | 4d 61 69 6e 57 69 6e 64 |;.void..|MainWind|
|00000670| 6f 77 43 6c 69 63 6b 28 | 57 69 6e 64 6f 77 50 74 |owClick(|WindowPt|
|00000680| 72 20 77 69 6e 64 6f 77 | 2c 20 45 76 65 6e 74 52 |r window|, EventR|
|00000690| 65 63 6f 72 64 20 2a 65 | 76 65 6e 74 29 3b 0d 70 |ecord *e|vent);.p|
|000006a0| 61 73 63 61 6c 20 76 6f | 69 64 09 09 53 63 72 6f |ascal vo|id..Scro|
|000006b0| 6c 6c 41 64 6a 75 73 74 | 28 43 6f 6e 74 72 6f 6c |llAdjust|(Control|
|000006c0| 48 61 6e 64 6c 65 20 63 | 6f 6e 74 72 6f 6c 2c 20 |Handle c|ontrol, |
|000006d0| 73 68 6f 72 74 20 70 61 | 72 74 29 3b 0d 43 6f 6e |short pa|rt);.Con|
|000006e0| 74 72 6f 6c 48 61 6e 64 | 6c 65 09 46 69 6e 64 4d |trolHand|le.FindM|
|000006f0| 79 43 6f 6e 74 72 6f 6c | 28 57 69 6e 64 6f 77 50 |yControl|(WindowP|
|00000700| 74 72 20 77 69 6e 64 6f | 77 2c 20 73 68 6f 72 74 |tr windo|w, short|
|00000710| 20 63 6e 74 6c 52 65 66 | 43 6f 6e 29 3b 0d 0d 0d | cntlRef|Con);...|
|00000720| 2f 2f 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |//~~~~~~|~~~~~~~~|
|00000730| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000740| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000750| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000760| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000770| 7e 7e 0d 2f 2f 54 68 69 | 73 20 72 6f 75 74 69 6e |~~.//Thi|s routin|
|00000780| 65 20 69 73 20 70 61 72 | 74 20 6f 66 20 74 68 65 |e is par|t of the|
|00000790| 20 4d 50 57 20 72 75 6e | 74 69 6d 65 20 6c 69 62 | MPW run|time lib|
|000007a0| 72 61 72 79 2e 20 54 68 | 69 73 20 65 78 74 65 72 |rary. Th|is exter|
|000007b0| 6e 61 6c 20 72 65 66 65 | 72 65 6e 63 65 0d 2f 2f |nal refe|rence.//|
|000007c0| 20 74 6f 20 69 74 20 69 | 73 20 64 6f 6e 65 20 73 | to it i|s done s|
|000007d0| 6f 20 74 68 61 74 20 77 | 65 20 63 61 6e 20 75 6e |o that w|e can un|
|000007e0| 6c 6f 61 64 20 69 74 73 | 20 73 65 67 6d 65 6e 74 |load its| segment|
|000007f0| 2c 20 25 41 35 49 6e 69 | 74 2e 0d 0d 65 78 74 65 |, %A5Ini|t...exte|
|00000800| 72 6e 20 76 6f 69 64 20 | 5f 44 61 74 61 49 6e 69 |rn void |_DataIni|
|00000810| 74 28 29 3b 0d 0d 0d 2f | 2f 7e 7e 7e 7e 7e 7e 7e |t();.../|/~~~~~~~|
|00000820| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000830| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000840| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000850| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000860| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 0d 76 6f 69 64 20 6d |~~~~~~~~|~.void m|
|00000870| 61 69 6e 28 76 6f 69 64 | 29 0d 7b 0d 09 55 6e 6c |ain(void|).{..Unl|
|00000880| 6f 61 64 53 65 67 28 28 | 50 74 72 29 20 5f 44 61 |oadSeg((|Ptr) _Da|
|00000890| 74 61 49 6e 69 74 29 3b | 09 09 2f 2f 20 5f 44 61 |taInit);|..// _Da|
|000008a0| 74 61 49 6e 69 74 20 6d | 75 73 74 20 6e 6f 74 20 |taInit m|ust not |
|000008b0| 62 65 20 69 6e 20 74 68 | 65 20 4d 61 69 6e 20 63 |be in th|e Main c|
|000008c0| 6f 64 65 20 73 65 67 6d | 65 6e 74 0d 0d 09 4d 61 |ode segm|ent...Ma|
|000008d0| 78 41 70 70 6c 5a 6f 6e | 65 28 29 3b 09 09 09 09 |xApplZon|e();....|
|000008e0| 09 2f 2f 20 65 78 70 61 | 6e 64 20 74 68 65 20 68 |.// expa|nd the h|
|000008f0| 65 61 70 20 73 6f 20 63 | 6f 64 65 20 73 65 67 6d |eap so c|ode segm|
|00000900| 65 6e 74 73 20 6c 6f 61 | 64 20 61 74 20 74 68 65 |ents loa|d at the|
|00000910| 20 74 6f 70 0d 09 49 6e | 69 74 69 61 6c 69 7a 65 | top..In|itialize|
|00000920| 28 29 3b 09 09 09 09 09 | 2f 2f 20 69 6e 69 74 69 |();.....|// initi|
|00000930| 61 6c 69 7a 65 20 74 68 | 65 20 70 72 6f 67 72 61 |alize th|e progra|
|00000940| 6d 0d 09 45 76 65 6e 74 | 4c 6f 6f 70 28 29 3b 09 |m..Event|Loop();.|
|00000950| 09 09 09 09 2f 2f 20 63 | 61 6c 6c 20 74 68 65 20 |....// c|all the |
|00000960| 6d 61 69 6e 20 65 76 65 | 6e 74 20 6c 6f 6f 70 0d |main eve|nt loop.|
|00000970| 7d 0d 0d 0d 2f 2f 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |}...//~~|~~~~~~~~|
|00000980| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000990| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000009a0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000009b0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000009c0| 7e 7e 7e 7e 7e 7e 0d 2f | 2f 20 47 65 74 20 65 76 |~~~~~~./|/ Get ev|
|000009d0| 65 6e 74 73 20 66 6f 72 | 65 76 65 72 2c 20 61 6e |ents for|ever, an|
|000009e0| 64 20 68 61 6e 64 6c 65 | 20 74 68 65 6d 20 62 79 |d handle| them by|
|000009f0| 20 63 61 6c 6c 69 6e 67 | 20 44 6f 45 76 65 6e 74 | calling| DoEvent|
|00000a00| 2e 20 47 65 74 20 74 68 | 65 20 65 76 65 6e 74 73 |. Get th|e events|
|00000a10| 20 62 79 0d 2f 2f 20 63 | 61 6c 6c 69 6e 67 20 57 | by.// c|alling W|
|00000a20| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 2e 20 20 54 |aitNextE|vent. T|
|00000a30| 68 69 73 20 69 73 20 61 | 6c 77 61 79 20 61 76 61 |his is a|lway ava|
|00000a40| 69 6c 61 62 6c 65 20 69 | 6e 20 53 79 73 74 65 6d |ilable i|n System|
|00000a50| 20 36 20 6f 72 20 6c 61 | 74 65 72 2e 0d 2f 2f 20 | 6 or la|ter..// |
|00000a60| 57 61 69 74 4e 65 78 74 | 45 76 65 6e 74 20 77 69 |WaitNext|Event wi|
|00000a70| 6c 6c 20 72 65 74 75 72 | 6e 20 66 61 6c 73 65 20 |ll retur|n false |
|00000a80| 69 6e 73 74 65 61 64 20 | 6f 66 20 67 69 76 69 6e |instead |of givin|
|00000a90| 67 20 75 70 20 61 20 6e | 75 6c 6c 45 76 65 6e 74 |g up a n|ullEvent|
|00000aa0| 2e 0d 0d 76 6f 69 64 20 | 45 76 65 6e 74 4c 6f 6f |...void |EventLoo|
|00000ab0| 70 28 76 6f 69 64 29 0d | 7b 0d 09 45 76 65 6e 74 |p(void).|{..Event|
|00000ac0| 52 65 63 6f 72 64 09 65 | 76 65 6e 74 3b 0d 0d 09 |Record.e|vent;...|
|00000ad0| 77 68 69 6c 65 20 28 74 | 72 75 65 29 20 7b 0d 09 |while (t|rue) {..|
|00000ae0| 09 69 66 20 28 20 57 61 | 69 74 4e 65 78 74 45 76 |.if ( Wa|itNextEv|
|00000af0| 65 6e 74 28 65 76 65 72 | 79 45 76 65 6e 74 2c 20 |ent(ever|yEvent, |
|00000b00| 26 65 76 65 6e 74 2c 20 | 47 65 74 53 6c 65 65 70 |&event, |GetSleep|
|00000b10| 28 29 2c 20 6e 69 6c 29 | 20 29 0d 09 09 09 44 6f |(), nil)| )....Do|
|00000b20| 45 76 65 6e 74 28 26 65 | 76 65 6e 74 29 3b 0d 09 |Event(&e|vent);..|
|00000b30| 09 65 6c 73 65 0d 09 09 | 09 44 6f 49 64 6c 65 28 |.else...|.DoIdle(|
|00000b40| 29 3b 0d 09 7d 0d 7d 0d | 0d 2f 2f 7e 7e 7e 7e 7e |);..}.}.|.//~~~~~|
|00000b50| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000b60| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000b70| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000b80| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000b90| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 0d 76 6f 69 64 |~~~~~~~~|~~~.void|
|00000ba0| 20 44 6f 45 76 65 6e 74 | 28 45 76 65 6e 74 52 65 | DoEvent|(EventRe|
|00000bb0| 63 6f 72 64 20 2a 65 76 | 65 6e 74 29 0d 7b 0d 09 |cord *ev|ent).{..|
|00000bc0| 73 68 6f 72 74 09 09 70 | 61 72 74 2c 20 65 72 72 |short..p|art, err|
|00000bd0| 3b 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |;..Windo|wPtr.win|
|00000be0| 64 6f 77 3b 0d 09 63 68 | 61 72 09 09 6b 65 79 3b |dow;..ch|ar..key;|
|00000bf0| 0d 0d 09 73 77 69 74 63 | 68 20 28 65 76 65 6e 74 |...switc|h (event|
|00000c00| 2d 3e 77 68 61 74 29 20 | 7b 0d 09 09 63 61 73 65 |->what) |{...case|
|00000c10| 20 6d 6f 75 73 65 44 6f | 77 6e 3a 0d 09 09 09 70 | mouseDo|wn:....p|
|00000c20| 61 72 74 20 3d 20 46 69 | 6e 64 57 69 6e 64 6f 77 |art = Fi|ndWindow|
|00000c30| 28 65 76 65 6e 74 2d 3e | 77 68 65 72 65 2c 20 26 |(event->|where, &|
|00000c40| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 73 77 69 74 |window);|....swit|
|00000c50| 63 68 20 28 70 61 72 74 | 29 20 7b 0d 09 09 09 09 |ch (part|) {.....|
|00000c60| 63 61 73 65 20 69 6e 4d | 65 6e 75 42 61 72 3a 0d |case inM|enuBar:.|
|00000c70| 09 09 09 09 09 41 64 6a | 75 73 74 4d 65 6e 75 73 |.....Adj|ustMenus|
|00000c80| 28 29 3b 09 09 09 09 09 | 2f 2f 20 62 72 69 6e 67 |();.....|// bring|
|00000c90| 20 d5 65 6d 20 75 70 2d | 74 6f 2d 64 61 74 65 0d | .em up-|to-date.|
|00000ca0| 09 09 09 09 09 44 6f 4d | 65 6e 75 43 6f 6d 6d 61 |.....DoM|enuComma|
|00000cb0| 6e 64 28 4d 65 6e 75 53 | 65 6c 65 63 74 28 65 76 |nd(MenuS|elect(ev|
|00000cc0| 65 6e 74 2d 3e 77 68 65 | 72 65 29 29 3b 0d 09 09 |ent->whe|re));...|
|00000cd0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|00000ce0| 73 65 20 69 6e 53 79 73 | 57 69 6e 64 6f 77 3a 0d |se inSys|Window:.|
|00000cf0| 09 09 09 09 09 53 79 73 | 74 65 6d 43 6c 69 63 6b |.....Sys|temClick|
|00000d00| 28 65 76 65 6e 74 2c 20 | 77 69 6e 64 6f 77 29 3b |(event, |window);|
|00000d10| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00000d20| 09 63 61 73 65 20 69 6e | 43 6f 6e 74 65 6e 74 3a |.case in|Content:|
|00000d30| 0d 09 09 09 09 09 69 66 | 20 28 77 69 6e 64 6f 77 |......if| (window|
|00000d40| 20 21 3d 20 46 72 6f 6e | 74 57 69 6e 64 6f 77 28 | != Fron|tWindow(|
|00000d50| 29 29 0d 09 09 09 09 09 | 09 53 65 6c 65 63 74 57 |))......|.SelectW|
|00000d60| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 3b 0d 09 |indow(wi|ndow);..|
|00000d70| 09 09 09 09 65 6c 73 65 | 0d 09 09 09 09 09 09 44 |....else|.......D|
|00000d80| 6f 43 6f 6e 74 65 6e 74 | 43 6c 69 63 6b 28 77 69 |oContent|Click(wi|
|00000d90| 6e 64 6f 77 2c 20 65 76 | 65 6e 74 29 3b 0d 09 09 |ndow, ev|ent);...|
|00000da0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|00000db0| 73 65 20 69 6e 44 72 61 | 67 3a 0d 09 09 09 09 09 |se inDra|g:......|
|00000dc0| 44 72 61 67 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |DragWind|ow(windo|
|00000dd0| 77 2c 20 65 76 65 6e 74 | 2d 3e 77 68 65 72 65 2c |w, event|->where,|
|00000de0| 20 26 71 64 2e 73 63 72 | 65 65 6e 42 69 74 73 2e | &qd.scr|eenBits.|
|00000df0| 62 6f 75 6e 64 73 29 3b | 0d 09 09 09 09 09 62 72 |bounds);|......br|
|00000e00| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 69 6e |eak;....|.case in|
|00000e10| 47 6f 41 77 61 79 3a 0d | 09 09 09 09 09 69 66 20 |GoAway:.|.....if |
|00000e20| 28 54 72 61 63 6b 47 6f | 41 77 61 79 28 77 69 6e |(TrackGo|Away(win|
|00000e30| 64 6f 77 2c 20 65 76 65 | 6e 74 2d 3e 77 68 65 72 |dow, eve|nt->wher|
|00000e40| 65 29 29 0d 09 09 09 09 | 09 09 48 69 64 65 57 69 |e)).....|..HideWi|
|00000e50| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 3b 0d 09 09 |ndow(win|dow);...|
|00000e60| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|00000e70| 73 65 20 69 6e 47 72 6f | 77 3a 0d 09 09 09 09 09 |se inGro|w:......|
|00000e80| 62 72 65 61 6b 3b 0d 09 | 09 09 09 63 61 73 65 20 |break;..|...case |
|00000e90| 69 6e 5a 6f 6f 6d 49 6e | 3a 0d 09 09 09 09 63 61 |inZoomIn|:.....ca|
|00000ea0| 73 65 20 69 6e 5a 6f 6f | 6d 4f 75 74 3a 0d 09 09 |se inZoo|mOut:...|
|00000eb0| 09 09 09 69 66 20 28 54 | 72 61 63 6b 42 6f 78 28 |...if (T|rackBox(|
|00000ec0| 77 69 6e 64 6f 77 2c 20 | 65 76 65 6e 74 2d 3e 77 |window, |event->w|
|00000ed0| 68 65 72 65 2c 20 70 61 | 72 74 29 29 0d 09 09 09 |here, pa|rt))....|
|00000ee0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 7d 0d |...break|;.....}.|
|00000ef0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00000f00| 20 6b 65 79 44 6f 77 6e | 3a 0d 09 09 63 61 73 65 | keyDown|:...case|
|00000f10| 20 61 75 74 6f 4b 65 79 | 3a 0d 09 09 09 6b 65 79 | autoKey|:....key|
|00000f20| 20 3d 20 65 76 65 6e 74 | 2d 3e 6d 65 73 73 61 67 | = event|->messag|
|00000f30| 65 20 26 20 63 68 61 72 | 43 6f 64 65 4d 61 73 6b |e & char|CodeMask|
|00000f40| 3b 0d 09 09 09 69 66 20 | 28 65 76 65 6e 74 2d 3e |;....if |(event->|
|00000f50| 6d 6f 64 69 66 69 65 72 | 73 20 26 20 63 6d 64 4b |modifier|s & cmdK|
|00000f60| 65 79 29 20 7b 09 2f 2f | 20 43 6f 6d 6d 61 6e 64 |ey) {.//| Command|
|00000f70| 20 6b 65 79 20 64 6f 77 | 6e 0d 09 09 09 09 69 66 | key dow|n.....if|
|00000f80| 20 28 65 76 65 6e 74 2d | 3e 77 68 61 74 20 3d 3d | (event-|>what ==|
|00000f90| 20 6b 65 79 44 6f 77 6e | 29 20 7b 0d 09 09 09 09 | keyDown|) {.....|
|00000fa0| 09 41 64 6a 75 73 74 4d | 65 6e 75 73 28 29 3b 09 |.AdjustM|enus();.|
|00000fb0| 09 09 09 2f 2f 20 65 6e | 61 62 6c 65 2f 64 69 73 |...// en|able/dis|
|00000fc0| 61 62 6c 65 2f 63 68 65 | 63 6b 20 6d 65 6e 75 20 |able/che|ck menu |
|00000fd0| 69 74 65 6d 73 20 70 72 | 6f 70 65 72 6c 79 0d 09 |items pr|operly..|
|00000fe0| 09 09 09 09 44 6f 4d 65 | 6e 75 43 6f 6d 6d 61 6e |....DoMe|nuComman|
|00000ff0| 64 28 4d 65 6e 75 4b 65 | 79 28 6b 65 79 29 29 3b |d(MenuKe|y(key));|
|00001000| 0d 09 09 09 09 7d 0d 09 | 09 09 7d 0d 09 09 09 62 |.....}..|..}....b|
|00001010| 72 65 61 6b 3b 0d 09 09 | 63 61 73 65 20 61 63 74 |reak;...|case act|
|00001020| 69 76 61 74 65 45 76 74 | 3a 0d 09 09 09 44 6f 41 |ivateEvt|:....DoA|
|00001030| 63 74 69 76 61 74 65 28 | 28 57 69 6e 64 6f 77 50 |ctivate(|(WindowP|
|00001040| 74 72 29 20 65 76 65 6e | 74 2d 3e 6d 65 73 73 61 |tr) even|t->messa|
|00001050| 67 65 2c 20 28 65 76 65 | 6e 74 2d 3e 6d 6f 64 69 |ge, (eve|nt->modi|
|00001060| 66 69 65 72 73 20 26 20 | 61 63 74 69 76 65 46 6c |fiers & |activeFl|
|00001070| 61 67 29 20 21 3d 20 30 | 29 3b 0d 09 09 09 62 72 |ag) != 0|);....br|
|00001080| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 75 70 64 61 |eak;...c|ase upda|
|00001090| 74 65 45 76 74 3a 0d 09 | 09 09 44 6f 55 70 64 61 |teEvt:..|..DoUpda|
|000010a0| 74 65 28 28 57 69 6e 64 | 6f 77 50 74 72 29 20 65 |te((Wind|owPtr) e|
|000010b0| 76 65 6e 74 2d 3e 6d 65 | 73 73 61 67 65 29 3b 0d |vent->me|ssage);.|
|000010c0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|000010d0| 20 64 69 73 6b 45 76 74 | 3a 0d 09 09 09 69 66 20 | diskEvt|:....if |
|000010e0| 28 48 69 57 72 64 28 65 | 76 65 6e 74 2d 3e 6d 65 |(HiWrd(e|vent->me|
|000010f0| 73 73 61 67 65 29 20 21 | 3d 20 6e 6f 45 72 72 29 |ssage) !|= noErr)|
|00001100| 0d 09 09 09 09 65 72 72 | 20 3d 20 44 49 42 61 64 |.....err| = DIBad|
|00001110| 4d 6f 75 6e 74 28 6b 44 | 49 50 6f 73 69 74 69 6f |Mount(kD|IPositio|
|00001120| 6e 2c 20 65 76 65 6e 74 | 2d 3e 6d 65 73 73 61 67 |n, event|->messag|
|00001130| 65 29 3b 0d 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |e);....b|reak;...|
|00001140| 63 61 73 65 20 6f 73 45 | 76 74 3a 0d 09 09 09 73 |case osE|vt:....s|
|00001150| 77 69 74 63 68 20 28 65 | 76 65 6e 74 2d 3e 6d 65 |witch (e|vent->me|
|00001160| 73 73 61 67 65 20 3e 3e | 20 32 34 29 20 7b 0d 09 |ssage >>| 24) {..|
|00001170| 09 09 09 63 61 73 65 20 | 73 75 73 70 65 6e 64 52 |...case |suspendR|
|00001180| 65 73 75 6d 65 4d 65 73 | 73 61 67 65 3a 09 09 2f |esumeMes|sage:../|
|00001190| 2f 20 73 75 73 70 65 6e | 64 2f 72 65 73 75 6d 65 |/ suspen|d/resume|
|000011a0| 20 69 73 20 61 6c 73 6f | 20 61 6e 20 61 63 74 69 | is also| an acti|
|000011b0| 76 61 74 65 2f 64 65 61 | 63 74 69 76 61 74 65 0d |vate/dea|ctivate.|
|000011c0| 09 09 09 09 09 67 49 6e | 42 61 63 6b 67 72 6f 75 |.....gIn|Backgrou|
|000011d0| 6e 64 20 3d 20 28 65 76 | 65 6e 74 2d 3e 6d 65 73 |nd = (ev|ent->mes|
|000011e0| 73 61 67 65 20 26 20 72 | 65 73 75 6d 65 46 6c 61 |sage & r|esumeFla|
|000011f0| 67 29 20 3d 3d 20 30 3b | 0d 09 09 09 09 09 44 6f |g) == 0;|......Do|
|00001200| 41 63 74 69 76 61 74 65 | 28 46 72 6f 6e 74 57 69 |Activate|(FrontWi|
|00001210| 6e 64 6f 77 28 29 2c 20 | 21 67 49 6e 42 61 63 6b |ndow(), |!gInBack|
|00001220| 67 72 6f 75 6e 64 29 3b | 0d 09 09 09 09 09 62 72 |ground);|......br|
|00001230| 65 61 6b 3b 0d 09 09 09 | 7d 0d 09 09 09 62 72 65 |eak;....|}....bre|
|00001240| 61 6b 3b 0d 09 7d 0d 7d | 0d 0d 2f 2f 7e 7e 7e 7e |ak;..}.}|..//~~~~|
|00001250| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001260| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001270| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001280| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001290| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 0d 76 6f 69 |~~~~~~~~|~~~~.voi|
|000012a0| 64 20 44 6f 55 70 64 61 | 74 65 28 57 69 6e 64 6f |d DoUpda|te(Windo|
|000012b0| 77 50 74 72 20 77 69 6e | 64 6f 77 29 0d 7b 0d 09 |wPtr win|dow).{..|
|000012c0| 53 65 74 50 6f 72 74 28 | 77 69 6e 64 6f 77 29 3b |SetPort(|window);|
|000012d0| 0d 09 42 65 67 69 6e 55 | 70 64 61 74 65 28 77 69 |..BeginU|pdate(wi|
|000012e0| 6e 64 6f 77 29 3b 09 09 | 09 09 09 09 2f 2f 20 74 |ndow);..|....// t|
|000012f0| 68 69 73 20 73 65 74 73 | 20 75 70 20 74 68 65 20 |his sets| up the |
|00001300| 76 69 73 52 67 6e 0d 09 | 69 66 20 28 21 45 6d 70 |visRgn..|if (!Emp|
|00001310| 74 79 52 67 6e 28 77 69 | 6e 64 6f 77 2d 3e 76 69 |tyRgn(wi|ndow->vi|
|00001320| 73 52 67 6e 29 29 20 7b | 09 09 09 2f 2f 20 64 72 |sRgn)) {|...// dr|
|00001330| 61 77 20 69 66 20 75 70 | 64 61 74 69 6e 67 20 6e |aw if up|dating n|
|00001340| 65 65 64 73 20 74 6f 20 | 62 65 20 64 6f 6e 65 0d |eeds to |be done.|
|00001350| 0d 09 09 50 65 6e 4e 6f | 72 6d 61 6c 28 29 3b 09 |...PenNo|rmal();.|
|00001360| 09 09 09 09 09 09 2f 2f | 20 67 65 74 20 72 65 61 |......//| get rea|
|00001370| 64 79 20 66 6f 72 20 73 | 74 61 6e 64 61 72 64 20 |dy for s|tandard |
|00001380| 64 72 61 77 69 6e 67 0d | 09 09 73 77 69 74 63 68 |drawing.|..switch|
|00001390| 20 28 47 65 74 57 52 65 | 66 43 6f 6e 28 77 69 6e | (GetWRe|fCon(win|
|000013a0| 64 6f 77 29 29 20 7b 0d | 0d 09 09 09 63 61 73 65 |dow)) {.|....case|
|000013b0| 20 72 4d 61 69 6e 57 69 | 6e 64 6f 77 3a 0d 09 09 | rMainWi|ndow:...|
|000013c0| 09 09 44 72 61 77 4d 61 | 69 6e 57 69 6e 64 6f 77 |..DrawMa|inWindow|
|000013d0| 28 77 69 6e 64 6f 77 29 | 3b 0d 09 09 09 09 62 72 |(window)|;.....br|
|000013e0| 65 61 6b 3b 0d 0d 09 09 | 7d 0d 09 7d 0d 09 45 6e |eak;....|}..}..En|
|000013f0| 64 55 70 64 61 74 65 28 | 77 69 6e 64 6f 77 29 3b |dUpdate(|window);|
|00001400| 0d 7d 0d 0d 2f 2f 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.}..//~~|~~~~~~~~|
|00001410| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001420| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001430| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001440| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001450| 7e 7e 7e 7e 7e 7e 0d 76 | 6f 69 64 20 44 6f 41 63 |~~~~~~.v|oid DoAc|
|00001460| 74 69 76 61 74 65 28 57 | 69 6e 64 6f 77 50 74 72 |tivate(W|indowPtr|
|00001470| 20 77 69 6e 64 6f 77 2c | 20 42 6f 6f 6c 65 61 6e | window,| Boolean|
|00001480| 20 62 65 63 6f 6d 69 6e | 67 41 63 74 69 76 65 29 | becomin|gActive)|
|00001490| 0d 7b 0d 0d 23 70 72 61 | 67 6d 61 20 75 6e 75 73 |.{..#pra|gma unus|
|000014a0| 65 64 20 28 77 69 6e 64 | 6f 77 29 0d 0d 09 69 66 |ed (wind|ow)...if|
|000014b0| 20 28 62 65 63 6f 6d 69 | 6e 67 41 63 74 69 76 65 | (becomi|ngActive|
|000014c0| 29 20 7b 0d 09 7d 0d 09 | 65 6c 73 65 20 7b 0d 09 |) {..}..|else {..|
|000014d0| 7d 0d 7d 0d 0d 2f 2f 7e | 7e 7e 7e 7e 7e 7e 7e 7e |}.}..//~|~~~~~~~~|
|000014e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000014f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001500| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001510| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001520| 7e 7e 7e 7e 7e 7e 7e 0d | 76 6f 69 64 20 44 6f 43 |~~~~~~~.|void DoC|
|00001530| 6f 6e 74 65 6e 74 43 6c | 69 63 6b 28 57 69 6e 64 |ontentCl|ick(Wind|
|00001540| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 2c 20 45 76 |owPtr wi|ndow, Ev|
|00001550| 65 6e 74 52 65 63 6f 72 | 64 20 2a 65 76 65 6e 74 |entRecor|d *event|
|00001560| 29 0d 7b 0d 0d 09 73 77 | 69 74 63 68 20 28 47 65 |).{...sw|itch (Ge|
|00001570| 74 57 52 65 66 43 6f 6e | 28 77 69 6e 64 6f 77 29 |tWRefCon|(window)|
|00001580| 29 20 7b 0d 0d 09 09 63 | 61 73 65 20 72 4d 61 69 |) {....c|ase rMai|
|00001590| 6e 57 69 6e 64 6f 77 3a | 0d 09 09 09 4d 61 69 6e |nWindow:|....Main|
|000015a0| 57 69 6e 64 6f 77 43 6c | 69 63 6b 28 77 69 6e 64 |WindowCl|ick(wind|
|000015b0| 6f 77 2c 20 65 76 65 6e | 74 29 3b 0d 09 09 09 62 |ow, even|t);....b|
|000015c0| 72 65 61 6b 3b 0d 09 7d | 0d 7d 0d 0d 2f 2f 7e 7e |reak;..}|.}..//~~|
|000015d0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000015e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000015f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001600| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001610| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 0d 2f |~~~~~~~~|~~~~~~./|
|00001620| 2f 20 45 6e 61 62 6c 65 | 20 61 6e 64 20 64 69 73 |/ Enable| and dis|
|00001630| 61 62 6c 65 20 6d 65 6e | 75 73 20 62 61 73 65 64 |able men|us based|
|00001640| 20 6f 6e 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | on the |current |
|00001650| 73 74 61 74 65 2e 20 54 | 68 65 20 75 73 65 72 20 |state. T|he user |
|00001660| 63 61 6e 20 6f 6e 6c 79 | 0d 2f 2f 20 73 65 6c 65 |can only|.// sele|
|00001670| 63 74 20 65 6e 61 62 6c | 65 64 20 6d 65 6e 75 20 |ct enabl|ed menu |
|00001680| 69 74 65 6d 73 2e 20 57 | 65 20 73 65 74 20 75 70 |items. W|e set up|
|00001690| 20 61 6c 6c 20 74 68 65 | 20 6d 65 6e 75 20 69 74 | all the| menu it|
|000016a0| 65 6d 73 20 62 65 66 6f | 72 65 20 63 61 6c 6c 69 |ems befo|re calli|
|000016b0| 6e 67 0d 2f 2f 20 4d 65 | 6e 75 53 65 6c 65 63 74 |ng.// Me|nuSelect|
|000016c0| 20 6f 72 20 4d 65 6e 75 | 4b 65 79 2c 20 73 69 6e | or Menu|Key, sin|
|000016d0| 63 65 20 74 68 65 73 65 | 20 61 72 65 20 74 68 65 |ce these| are the|
|000016e0| 20 6f 6e 6c 79 20 74 69 | 6d 65 73 20 74 68 61 74 | only ti|mes that|
|000016f0| 20 61 20 6d 65 6e 75 20 | 69 74 65 6d 20 63 61 6e | a menu |item can|
|00001700| 0d 2f 2f 20 62 65 20 73 | 65 6c 65 63 74 65 64 2e |.// be s|elected.|
|00001710| 20 4e 6f 74 65 20 74 68 | 61 74 20 4d 65 6e 75 53 | Note th|at MenuS|
|00001720| 65 6c 65 63 74 20 69 73 | 20 61 6c 73 6f 20 74 68 |elect is| also th|
|00001730| 65 20 6f 6e 6c 79 20 74 | 69 6d 65 20 74 68 65 20 |e only t|ime the |
|00001740| 75 73 65 72 20 77 69 6c | 6c 20 73 65 65 0d 2f 2f |user wil|l see.//|
|00001750| 20 6d 65 6e 75 20 69 74 | 65 6d 73 2e 20 54 68 69 | menu it|ems. Thi|
|00001760| 73 20 61 70 70 72 6f 61 | 63 68 20 74 6f 20 64 65 |s approa|ch to de|
|00001770| 63 69 64 69 6e 67 20 77 | 68 61 74 20 65 6e 61 62 |ciding w|hat enab|
|00001780| 6c 65 2f 20 64 69 73 61 | 62 6c 65 20 73 74 61 74 |le/ disa|ble stat|
|00001790| 65 20 61 20 6d 65 6e 75 | 20 69 74 65 6d 0d 2f 2f |e a menu| item.//|
|000017a0| 20 68 61 73 20 74 68 65 | 20 61 64 76 61 6e 74 61 | has the| advanta|
|000017b0| 67 65 20 6f 66 20 63 6f | 6e 63 65 6e 74 72 61 74 |ge of co|ncentrat|
|000017c0| 69 6e 67 20 61 6c 6c 20 | 74 68 65 20 64 65 63 69 |ing all |the deci|
|000017d0| 73 69 6f 6e 2d 6d 61 6b | 69 6e 67 20 69 6e 20 6f |sion-mak|ing in o|
|000017e0| 6e 65 20 72 6f 75 74 69 | 6e 65 2c 0d 2f 2f 20 61 |ne routi|ne,.// a|
|000017f0| 73 20 6f 70 70 6f 73 65 | 64 20 74 6f 20 62 65 69 |s oppose|d to bei|
|00001800| 6e 67 20 73 70 72 65 61 | 64 20 74 68 72 6f 75 67 |ng sprea|d throug|
|00001810| 68 6f 75 74 20 74 68 65 | 20 61 70 70 6c 69 63 61 |hout the| applica|
|00001820| 74 69 6f 6e 2e 20 4f 74 | 68 65 72 20 61 70 70 6c |tion. Ot|her appl|
|00001830| 69 63 61 74 69 6f 6e 0d | 2f 2f 20 64 65 73 69 67 |ication.|// desig|
|00001840| 6e 73 20 6d 61 79 20 74 | 61 6b 65 20 61 20 64 69 |ns may t|ake a di|
|00001850| 66 66 65 72 65 6e 74 20 | 61 70 70 72 6f 61 63 68 |fferent |approach|
|00001860| 20 74 68 61 74 20 69 73 | 20 6a 75 73 74 20 61 73 | that is| just as|
|00001870| 20 76 61 6c 69 64 2e 0d | 0d 76 6f 69 64 20 41 64 | valid..|.void Ad|
|00001880| 6a 75 73 74 4d 65 6e 75 | 73 28 76 6f 69 64 29 0d |justMenu|s(void).|
|00001890| 7b 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |{..Windo|wPtr.win|
|000018a0| 64 6f 77 3b 0d 09 4d 65 | 6e 75 48 61 6e 64 6c 65 |dow;..Me|nuHandle|
|000018b0| 09 6d 65 6e 75 3b 0d 0d | 09 77 69 6e 64 6f 77 20 |.menu;..|.window |
|000018c0| 3d 20 46 72 6f 6e 74 57 | 69 6e 64 6f 77 28 29 3b |= FrontW|indow();|
|000018d0| 0d 0d 09 6d 65 6e 75 20 | 3d 20 47 65 74 4d 48 61 |...menu |= GetMHa|
|000018e0| 6e 64 6c 65 28 6d 45 64 | 69 74 29 3b 0d 09 69 66 |ndle(mEd|it);..if|
|000018f0| 20 28 20 49 73 44 41 57 | 69 6e 64 6f 77 28 77 69 | ( IsDAW|indow(wi|
|00001900| 6e 64 6f 77 29 20 29 20 | 7b 09 09 09 09 2f 2f 20 |ndow) ) |{....// |
|00001910| 61 20 64 65 73 6b 20 61 | 63 63 65 73 73 6f 72 79 |a desk a|ccessory|
|00001920| 20 6d 69 67 68 74 20 6e | 65 65 64 20 74 68 65 20 | might n|eed the |
|00001930| 65 64 69 74 20 6d 65 6e | 75 0d 09 09 45 6e 61 62 |edit men|u...Enab|
|00001940| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 55 6e |leItem(m|enu, iUn|
|00001950| 64 6f 29 3b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |do);...E|nableIte|
|00001960| 6d 28 6d 65 6e 75 2c 20 | 69 43 75 74 29 3b 0d 09 |m(menu, |iCut);..|
|00001970| 09 45 6e 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |.EnableI|tem(menu|
|00001980| 2c 20 69 43 6f 70 79 29 | 3b 0d 09 09 45 6e 61 62 |, iCopy)|;...Enab|
|00001990| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 43 6c |leItem(m|enu, iCl|
|000019a0| 65 61 72 29 3b 0d 09 09 | 45 6e 61 62 6c 65 49 74 |ear);...|EnableIt|
|000019b0| 65 6d 28 6d 65 6e 75 2c | 20 69 50 61 73 74 65 29 |em(menu,| iPaste)|
|000019c0| 3b 0d 09 7d 0d 09 65 6c | 73 65 20 7b 0d 09 09 44 |;..}..el|se {...D|
|000019d0| 69 73 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |isableIt|em(menu,|
|000019e0| 20 69 55 6e 64 6f 29 3b | 0d 09 09 44 69 73 61 62 | iUndo);|...Disab|
|000019f0| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 43 75 |leItem(m|enu, iCu|
|00001a00| 74 29 3b 0d 09 09 44 69 | 73 61 62 6c 65 49 74 65 |t);...Di|sableIte|
|00001a10| 6d 28 6d 65 6e 75 2c 20 | 69 43 6f 70 79 29 3b 0d |m(menu, |iCopy);.|
|00001a20| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|00001a30| 6e 75 2c 20 69 43 6c 65 | 61 72 29 3b 0d 09 09 44 |nu, iCle|ar);...D|
|00001a40| 69 73 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |isableIt|em(menu,|
|00001a50| 20 69 50 61 73 74 65 29 | 3b 0d 09 7d 0d 0d 7d 0d | iPaste)|;..}..}.|
|00001a60| 0d 2f 2f 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.//~~~~~|~~~~~~~~|
|00001a70| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001a80| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001a90| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001aa0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00001ab0| 7e 7e 7e 0d 2f 2f 20 54 | 68 69 73 20 69 73 20 63 |~~~.// T|his is c|
|00001ac0| 61 6c 6c 65 64 20 77 68 | 65 6e 20 61 6e 20 69 74 |alled wh|en an it|
|00001ad0| 65 6d 20 69 73 20 63 68 | 6f 73 65 6e 20 66 72 6f |em is ch|osen fro|
|00001ae0| 6d 20 74 68 65 20 6d 65 | 6e 75 20 62 61 72 20 28 |m the me|nu bar (|
|00001af0| 61 66 74 65 72 20 63 61 | 6c 6c 69 6e 67 0d 2f 2f |after ca|lling.//|
|00001b00| 20 4d 65 6e 75 53 65 6c | 65 63 74 20 6f 72 20 4d | MenuSel|ect or M|
|00001b10| 65 6e 75 4b 65 79 29 2e | 20 49 74 20 70 65 72 66 |enuKey).| It perf|
|00001b20| 6f 72 6d 73 20 74 68 65 | 20 72 69 67 68 74 20 6f |orms the| right o|
|00001b30| 70 65 72 61 74 69 6f 6e | 20 66 6f 72 20 65 61 63 |peration| for eac|
|00001b40| 68 20 63 6f 6d 6d 61 6e | 64 2e 20 49 74 0d 2f 2f |h comman|d. It.//|
|00001b50| 20 69 73 20 67 6f 6f 64 | 20 74 6f 20 68 61 76 65 | is good| to have|
|00001b60| 20 62 6f 74 68 20 74 68 | 65 20 72 65 73 75 6c 74 | both th|e result|
|00001b70| 20 6f 66 20 4d 65 6e 75 | 53 65 6c 65 63 74 20 61 | of Menu|Select a|
|00001b80| 6e 64 20 4d 65 6e 75 4b | 65 79 20 67 6f 20 74 6f |nd MenuK|ey go to|
|00001b90| 20 6f 6e 65 20 72 6f 75 | 74 69 6e 65 0d 2f 2f 20 | one rou|tine.// |
|00001ba0| 6c 69 6b 65 20 74 68 69 | 73 20 74 6f 20 6b 65 65 |like thi|s to kee|
|00001bb0| 70 20 65 76 65 72 79 74 | 68 69 6e 67 20 6f 72 67 |p everyt|hing org|
|00001bc0| 61 6e 69 7a 65 64 2e 0d | 0d 76 6f 69 64 20 44 6f |anized..|.void Do|
|00001bd0| 4d 65 6e 75 43 6f 6d 6d | 61 6e 64 28 6c 6f 6e 67 |MenuComm|and(long|
|00001be0| 20 6d 65 6e 75 52 65 73 | 75 6c 74 29 0d 7b 0d 09 | menuRes|ult).{..|
|00001bf0| 53 74 72 32 35 35 09 09 | 64 61 4e 61 6d 65 3b 0d |Str255..|daName;.|
|00001c00| 09 73 68 6f 72 74 09 09 | 64 61 52 65 66 4e 75 6d |.short..|daRefNum|
|00001c10| 3b 0d 09 73 68 6f 72 74 | 09 09 6d 65 6e 75 49 44 |;..short|..menuID|
|00001c20| 3b 0d 09 73 68 6f 72 74 | 09 09 6d 65 6e 75 49 74 |;..short|..menuIt|
|00001c30| 65 6d 3b 0d 09 73 68 6f | 72 74 09 09 69 74 65 6d |em;..sho|rt..item|
|00001c40| 48 69 74 3b 0d 09 4f 53 | 45 72 72 09 09 65 72 72 |Hit;..OS|Err..err|
|00001c50| 3b 0d 0d 09 6d 65 6e 75 | 49 44 20 3d 20 48 69 57 |;...menu|ID = HiW|
|00001c60| 72 64 28 6d 65 6e 75 52 | 65 73 75 6c 74 29 3b 0d |rd(menuR|esult);.|
|00001c70| 09 6d 65 6e 75 49 74 65 | 6d 20 3d 20 4c 6f 57 72 |.menuIte|m = LoWr|
|00001c80| 64 28 6d 65 6e 75 52 65 | 73 75 6c 74 29 3b 0d 09 |d(menuRe|sult);..|
|00001c90| 73 77 69 74 63 68 20 28 | 6d 65 6e 75 49 44 29 20 |switch (|menuID) |
|00001ca0| 7b 0d 09 09 63 61 73 65 | 20 6d 41 70 70 6c 65 3a |{...case| mApple:|
|00001cb0| 0d 09 09 09 73 77 69 74 | 63 68 20 28 6d 65 6e 75 |....swit|ch (menu|
|00001cc0| 49 74 65 6d 29 20 7b 0d | 09 09 09 09 63 61 73 65 |Item) {.|....case|
|00001cd0| 20 69 41 62 6f 75 74 3a | 09 09 2f 2f 20 62 72 69 | iAbout:|..// bri|
|00001ce0| 6e 67 20 75 70 20 61 6c | 65 72 74 20 66 6f 72 20 |ng up al|ert for |
|00001cf0| 41 62 6f 75 74 0d 09 09 | 09 09 09 69 74 65 6d 48 |About...|...itemH|
|00001d00| 69 74 20 3d 20 41 6c 65 | 72 74 28 72 41 62 6f 75 |it = Ale|rt(rAbou|
|00001d10| 74 41 6c 65 72 74 2c 20 | 6e 69 6c 29 3b 0d 09 09 |tAlert, |nil);...|
|00001d20| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 64 65 |...break|;.....de|
|00001d30| 66 61 75 6c 74 3a 09 09 | 09 2f 2f 20 61 6c 6c 20 |fault:..|.// all |
|00001d40| 6e 6f 6e 2d 41 62 6f 75 | 74 20 69 74 65 6d 73 20 |non-Abou|t items |
|00001d50| 69 6e 20 74 68 69 73 20 | 6d 65 6e 75 20 61 72 65 |in this |menu are|
|00001d60| 20 44 41 73 20 65 74 20 | 61 6c 0d 09 09 09 09 09 | DAs et |al......|
|00001d70| 47 65 74 49 74 65 6d 28 | 47 65 74 4d 48 61 6e 64 |GetItem(|GetMHand|
|00001d80| 6c 65 28 6d 41 70 70 6c | 65 29 2c 20 6d 65 6e 75 |le(mAppl|e), menu|
|00001d90| 49 74 65 6d 2c 20 64 61 | 4e 61 6d 65 29 3b 0d 09 |Item, da|Name);..|
|00001da0| 09 09 09 09 64 61 52 65 | 66 4e 75 6d 20 3d 20 4f |....daRe|fNum = O|
|00001db0| 70 65 6e 44 65 73 6b 41 | 63 63 28 64 61 4e 61 6d |penDeskA|cc(daNam|
|00001dc0| 65 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |e);.....|.break;.|
|00001dd0| 09 09 09 7d 0d 09 09 09 | 62 72 65 61 6b 3b 0d 09 |...}....|break;..|
|00001de0| 09 63 61 73 65 20 6d 46 | 69 6c 65 3a 0d 09 09 09 |.case mF|ile:....|
|00001df0| 73 77 69 74 63 68 20 28 | 6d 65 6e 75 49 74 65 6d |switch (|menuItem|
|00001e00| 29 20 7b 0d 09 09 09 09 | 63 61 73 65 20 69 50 6c |) {.....|case iPl|
|00001e10| 61 79 3a 0d 09 09 09 09 | 09 4b 69 6c 6c 44 6f 75 |ay:.....|.KillDou|
|00001e20| 62 6c 65 42 75 66 66 65 | 72 20 28 29 3b 09 09 09 |bleBuffe|r ();...|
|00001e30| 09 09 09 09 09 2f 2f 20 | 73 74 6f 70 20 63 75 72 |.....// |stop cur|
|00001e40| 72 65 6e 74 20 70 6c 61 | 79 20 61 6e 64 0d 09 09 |rent pla|y and...|
|00001e50| 09 09 09 46 72 65 65 44 | 42 50 72 69 76 61 74 65 |...FreeD|BPrivate|
|00001e60| 4d 65 6d 20 28 67 50 72 | 69 76 61 74 65 50 74 72 |Mem (gPr|ivatePtr|
|00001e70| 29 3b 09 09 09 09 09 09 | 2f 2f 20 72 65 6c 65 61 |);......|// relea|
|00001e80| 73 65 20 69 74 27 73 20 | 6d 65 6d 6f 72 79 0d 0d |se it's |memory..|
|00001e90| 09 09 09 09 09 65 72 72 | 20 3d 20 50 6c 61 79 46 |.....err| = PlayF|
|00001ea0| 69 6c 65 28 74 72 75 65 | 2c 20 26 67 50 72 69 76 |ile(true|, &gPriv|
|00001eb0| 61 74 65 50 74 72 29 3b | 0d 09 09 09 09 09 69 66 |atePtr);|......if|
|00001ec0| 20 28 65 72 72 20 21 3d | 20 6e 6f 45 72 72 29 0d | (err !=| noErr).|
|00001ed0| 09 09 09 09 09 09 41 6c | 65 72 74 55 73 65 72 28 |......Al|ertUser(|
|00001ee0| 65 72 72 2c 20 65 55 6e | 65 78 70 65 63 74 65 64 |err, eUn|expected|
|00001ef0| 2c 20 21 6b 46 61 74 61 | 6c 45 72 72 6f 72 29 3b |, !kFata|lError);|
|00001f00| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00001f10| 09 63 61 73 65 20 69 50 | 6c 61 79 42 61 63 6b 77 |.case iP|layBackw|
|00001f20| 61 72 64 73 3a 0d 09 09 | 09 09 09 4b 69 6c 6c 44 |ards:...|...KillD|
|00001f30| 6f 75 62 6c 65 42 75 66 | 66 65 72 20 28 29 3b 09 |oubleBuf|fer ();.|
|00001f40| 09 09 09 09 09 09 09 2f | 2f 20 73 74 6f 70 20 63 |......./|/ stop c|
|00001f50| 75 72 72 65 6e 74 20 70 | 6c 61 79 20 61 6e 64 0d |urrent p|lay and.|
|00001f60| 09 09 09 09 09 46 72 65 | 65 44 42 50 72 69 76 61 |.....Fre|eDBPriva|
|00001f70| 74 65 4d 65 6d 20 28 67 | 50 72 69 76 61 74 65 50 |teMem (g|PrivateP|
|00001f80| 74 72 29 3b 09 09 09 09 | 09 09 2f 2f 20 72 65 6c |tr);....|..// rel|
|00001f90| 65 61 73 65 20 69 74 27 | 73 20 6d 65 6d 6f 72 79 |ease it'|s memory|
|00001fa0| 0d 0d 09 09 09 09 09 65 | 72 72 20 3d 20 50 6c 61 |.......e|rr = Pla|
|00001fb0| 79 46 69 6c 65 28 66 61 | 6c 73 65 2c 20 26 67 50 |yFile(fa|lse, &gP|
|00001fc0| 72 69 76 61 74 65 50 74 | 72 29 3b 0d 09 09 09 09 |rivatePt|r);.....|
|00001fd0| 09 69 66 20 28 65 72 72 | 20 21 3d 20 6e 6f 45 72 |.if (err| != noEr|
|00001fe0| 72 29 0d 09 09 09 09 09 | 09 41 6c 65 72 74 55 73 |r)......|.AlertUs|
|00001ff0| 65 72 28 65 72 72 2c 20 | 65 55 6e 65 78 70 65 63 |er(err, |eUnexpec|
|00002000| 74 65 64 2c 20 21 6b 46 | 61 74 61 6c 45 72 72 6f |ted, !kF|atalErro|
|00002010| 72 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |r);.....|.break;.|
|00002020| 09 09 09 09 63 61 73 65 | 20 69 52 65 63 6f 72 64 |....case| iRecord|
|00002030| 3a 0d 09 09 09 09 09 65 | 72 72 20 3d 20 52 65 63 |:......e|rr = Rec|
|00002040| 6f 72 64 41 49 46 46 46 | 69 6c 65 28 6b 41 70 70 |ordAIFFF|ile(kApp|
|00002050| 43 72 65 61 74 6f 72 29 | 3b 0d 09 09 09 09 09 69 |Creator)|;......i|
|00002060| 66 20 28 65 72 72 20 21 | 3d 20 6e 6f 45 72 72 29 |f (err !|= noErr)|
|00002070| 0d 09 09 09 09 09 09 41 | 6c 65 72 74 55 73 65 72 |.......A|lertUser|
|00002080| 28 65 72 72 2c 20 65 55 | 6e 65 78 70 65 63 74 65 |(err, eU|nexpecte|
|00002090| 64 2c 20 21 6b 46 61 74 | 61 6c 45 72 72 6f 72 29 |d, !kFat|alError)|
|000020a0| 3b 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |;......b|reak;...|
|000020b0| 09 09 63 61 73 65 20 69 | 53 79 6e 74 68 69 73 69 |..case i|Synthisi|
|000020c0| 7a 65 3a 0d 09 09 09 09 | 09 67 55 70 64 61 74 65 |ze:.....|.gUpdate|
|000020d0| 57 61 76 65 20 3d 20 74 | 72 75 65 3b 0d 09 09 09 |Wave = t|rue;....|
|000020e0| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 09 63 61 73 |..break;|.....cas|
|000020f0| 65 20 69 4b 69 6c 6c 3a | 0d 09 09 09 09 09 4b 69 |e iKill:|......Ki|
|00002100| 6c 6c 44 6f 75 62 6c 65 | 42 75 66 66 65 72 20 28 |llDouble|Buffer (|
|00002110| 29 3b 09 09 09 09 09 09 | 09 09 2f 2f 20 73 74 6f |);......|..// sto|
|00002120| 70 20 63 75 72 72 65 6e | 74 20 70 6c 61 79 20 61 |p curren|t play a|
|00002130| 6e 64 0d 09 09 09 09 09 | 46 72 65 65 44 42 50 72 |nd......|FreeDBPr|
|00002140| 69 76 61 74 65 4d 65 6d | 20 28 67 50 72 69 76 61 |ivateMem| (gPriva|
|00002150| 74 65 50 74 72 29 3b 09 | 09 09 09 09 09 2f 2f 20 |tePtr);.|.....// |
|00002160| 72 65 6c 65 61 73 65 20 | 69 74 27 73 20 6d 65 6d |release |it's mem|
|00002170| 6f 72 79 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |ory.....|.break;.|
|00002180| 09 09 09 09 63 61 73 65 | 20 69 51 75 69 74 3a 0d |....case| iQuit:.|
|00002190| 09 09 09 09 09 54 65 72 | 6d 69 6e 61 74 65 28 29 |.....Ter|minate()|
|000021a0| 3b 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |;......b|reak;...|
|000021b0| 09 7d 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 7d 0d |.}....br|eak;..}.|
|000021c0| 09 48 69 6c 69 74 65 4d | 65 6e 75 28 30 29 3b 20 |.HiliteM|enu(0); |
|000021d0| 2f 2f 20 75 6e 68 69 67 | 68 6c 69 67 68 74 20 77 |// unhig|hlight w|
|000021e0| 68 61 74 20 4d 65 6e 75 | 53 65 6c 65 63 74 20 28 |hat Menu|Select (|
|000021f0| 6f 72 20 4d 65 6e 75 4b | 65 79 29 20 68 69 6c 69 |or MenuK|ey) hili|
|00002200| 74 65 64 0d 7d 0d 0d 2f | 2f 7e 7e 7e 7e 7e 7e 7e |ted.}../|/~~~~~~~|
|00002210| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002220| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002230| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002240| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002250| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 0d 2f 2f 20 43 6c 6f |~~~~~~~~|~.// Clo|
|00002260| 73 65 20 61 20 77 69 6e | 64 6f 77 20 61 6e 64 20 |se a win|dow and |
|00002270| 64 69 73 70 6f 73 65 20 | 6f 66 20 61 6e 79 20 61 |dispose |of any a|
|00002280| 73 73 6f 63 69 61 74 69 | 6e 67 20 64 61 74 61 2e |ssociati|ng data.|
|00002290| 20 54 68 69 73 20 68 61 | 6e 64 6c 65 73 20 64 65 | This ha|ndles de|
|000022a0| 73 6b 20 61 63 63 65 73 | 73 6f 72 79 0d 2f 2f 20 |sk acces|sory.// |
|000022b0| 61 6e 64 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |and appl|ication |
|000022c0| 77 69 6e 64 6f 77 73 2e | 0d 0d 76 6f 69 64 20 44 |windows.|..void D|
|000022d0| 6f 43 6c 6f 73 65 57 69 | 6e 64 6f 77 28 57 69 6e |oCloseWi|ndow(Win|
|000022e0| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 29 0d 7b |dowPtr w|indow).{|
|000022f0| 0d 09 69 66 20 28 49 73 | 44 41 57 69 6e 64 6f 77 |..if (Is|DAWindow|
|00002300| 28 77 69 6e 64 6f 77 29 | 29 0d 09 09 43 6c 6f 73 |(window)|)...Clos|
|00002310| 65 44 65 73 6b 41 63 63 | 28 28 28 57 69 6e 64 6f |eDeskAcc|(((Windo|
|00002320| 77 50 65 65 6b 29 20 77 | 69 6e 64 6f 77 29 2d 3e |wPeek) w|indow)->|
|00002330| 77 69 6e 64 6f 77 4b 69 | 6e 64 29 3b 0d 09 65 6c |windowKi|nd);..el|
|00002340| 73 65 20 7b 0d 09 09 73 | 77 69 74 63 68 20 28 47 |se {...s|witch (G|
|00002350| 65 74 57 52 65 66 43 6f | 6e 28 77 69 6e 64 6f 77 |etWRefCo|n(window|
|00002360| 29 29 20 7b 0d 0d 09 09 | 09 63 61 73 65 20 72 4d |)) {....|.case rM|
|00002370| 61 69 6e 57 69 6e 64 6f | 77 3a 0d 09 09 09 09 44 |ainWindo|w:.....D|
|00002380| 69 73 70 6f 73 65 57 69 | 6e 64 6f 77 28 77 69 6e |isposeWi|ndow(win|
|00002390| 64 6f 77 29 3b 0d 09 09 | 09 09 62 72 65 61 6b 3b |dow);...|..break;|
|000023a0| 0d 09 09 7d 0d 09 7d 0d | 7d 0d 0d 2f 2f 7e 7e 7e |...}..}.|}..//~~~|
|000023b0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000023c0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000023d0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000023e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000023f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 0d 76 6f |~~~~~~~~|~~~~~.vo|
|00002400| 69 64 20 54 65 72 6d 69 | 6e 61 74 65 28 29 0d 7b |id Termi|nate().{|
|00002410| 0d 09 57 69 6e 64 6f 77 | 50 74 72 09 61 57 69 6e |..Window|Ptr.aWin|
|00002420| 64 6f 77 3b 0d 0d 09 64 | 6f 20 7b 0d 09 09 61 57 |dow;...d|o {...aW|
|00002430| 69 6e 64 6f 77 20 3d 20 | 46 72 6f 6e 74 57 69 6e |indow = |FrontWin|
|00002440| 64 6f 77 28 29 3b 09 09 | 09 09 2f 2f 20 67 65 74 |dow();..|..// get|
|00002450| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 66 72 6f | the cur|rent fro|
|00002460| 6e 74 20 77 69 6e 64 6f | 77 0d 09 09 69 66 20 28 |nt windo|w...if (|
|00002470| 61 57 69 6e 64 6f 77 20 | 21 3d 20 6e 69 6c 29 0d |aWindow |!= nil).|
|00002480| 09 09 09 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 |...DoClo|seWindow|
|00002490| 28 61 57 69 6e 64 6f 77 | 29 3b 09 09 09 09 2f 2f |(aWindow|);....//|
|000024a0| 20 63 6c 6f 73 65 20 74 | 68 69 73 20 77 69 6e 64 | close t|his wind|
|000024b0| 6f 77 0d 09 7d 20 77 68 | 69 6c 65 20 28 61 57 69 |ow..} wh|ile (aWi|
|000024c0| 6e 64 6f 77 20 21 3d 20 | 6e 69 6c 29 3b 0d 0d 09 |ndow != |nil);...|
|000024d0| 43 6c 6f 73 65 44 6f 75 | 62 6c 65 42 75 66 66 65 |CloseDou|bleBuffe|
|000024e0| 72 28 29 3b 0d 09 45 78 | 69 74 54 6f 53 68 65 6c |r();..Ex|itToShel|
|000024f0| 6c 28 29 3b 09 09 09 09 | 09 09 09 09 2f 2f 20 65 |l();....|....// e|
|00002500| 78 69 74 20 69 66 20 6e | 6f 20 63 61 6e 63 65 6c |xit if n|o cancel|
|00002510| 6c 61 74 69 6f 6e 0d 7d | 0d 0d 2f 2f 7e 7e 7e 7e |lation.}|..//~~~~|
|00002520| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002530| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002540| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002550| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002560| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 0d 76 6f 69 |~~~~~~~~|~~~~.voi|
|00002570| 64 20 49 6e 69 74 69 61 | 6c 69 7a 65 28 29 0d 7b |d Initia|lize().{|
|00002580| 0d 09 48 61 6e 64 6c 65 | 09 09 09 6d 65 6e 75 42 |..Handle|...menuB|
|00002590| 61 72 3b 0d 09 45 76 65 | 6e 74 52 65 63 6f 72 64 |ar;..Eve|ntRecord|
|000025a0| 20 09 65 76 65 6e 74 3b | 0d 09 73 68 6f 72 74 09 | .event;|..short.|
|000025b0| 09 09 63 6f 75 6e 74 3b | 0d 09 4f 53 45 72 72 09 |..count;|..OSErr.|
|000025c0| 09 09 65 72 72 3b 0d 09 | 6c 6f 6e 67 09 09 09 72 |..err;..|long...r|
|000025d0| 65 73 70 6f 6e 73 65 3b | 0d 0d 09 67 49 6e 42 61 |esponse;|...gInBa|
|000025e0| 63 6b 67 72 6f 75 6e 64 | 20 3d 20 66 61 6c 73 65 |ckground| = false|
|000025f0| 3b 0d 09 0d 09 67 50 72 | 69 76 61 74 65 50 74 72 |;....gPr|ivatePtr|
|00002600| 20 3d 20 6e 69 6c 3b 0d | 0d 09 49 6e 69 74 47 72 | = nil;.|..InitGr|
|00002610| 61 66 28 26 71 64 2e 74 | 68 65 50 6f 72 74 29 3b |af(&qd.t|hePort);|
|00002620| 0d 09 49 6e 69 74 46 6f | 6e 74 73 28 29 3b 0d 09 |..InitFo|nts();..|
|00002630| 49 6e 69 74 57 69 6e 64 | 6f 77 73 28 29 3b 0d 09 |InitWind|ows();..|
|00002640| 49 6e 69 74 4d 65 6e 75 | 73 28 29 3b 0d 09 54 45 |InitMenu|s();..TE|
|00002650| 49 6e 69 74 28 29 3b 0d | 09 49 6e 69 74 44 69 61 |Init();.|.InitDia|
|00002660| 6c 6f 67 73 28 6e 69 6c | 29 3b 0d 09 49 6e 69 74 |logs(nil|);..Init|
|00002670| 43 75 72 73 6f 72 28 29 | 3b 0d 0d 09 2f 2f 20 62 |Cursor()|;...// b|
|00002680| 72 69 6e 67 20 74 68 65 | 20 61 70 70 20 74 6f 20 |ring the| app to |
|00002690| 74 68 65 20 66 6f 72 65 | 67 72 6f 75 6e 64 0d 09 |the fore|ground..|
|000026a0| 66 6f 72 20 28 63 6f 75 | 6e 74 20 3d 20 31 3b 20 |for (cou|nt = 1; |
|000026b0| 63 6f 75 6e 74 20 3c 3d | 20 33 3b 20 63 6f 75 6e |count <=| 3; coun|
|000026c0| 74 2b 2b 29 0d 09 09 45 | 76 65 6e 74 41 76 61 69 |t++)...E|ventAvai|
|000026d0| 6c 28 65 76 65 72 79 45 | 76 65 6e 74 2c 20 26 65 |l(everyE|vent, &e|
|000026e0| 76 65 6e 74 29 3b 0d 0d | 09 2f 2f 20 49 20 77 61 |vent);..|.// I wa|
|000026f0| 6e 74 20 74 6f 20 6b 6e | 6f 77 20 69 66 20 57 61 |nt to kn|ow if Wa|
|00002700| 69 74 4e 65 78 74 45 76 | 65 6e 74 20 69 73 20 61 |itNextEv|ent is a|
|00002710| 76 61 69 6c 61 62 6c 65 | 2c 20 77 68 69 63 68 20 |vailable|, which |
|00002720| 69 73 20 61 6c 77 61 79 | 73 20 74 72 75 65 20 66 |is alway|s true f|
|00002730| 6f 72 0d 09 2f 2f 20 53 | 79 73 74 65 6d 20 36 2e |or..// S|ystem 6.|
|00002740| 30 32 20 6f 72 20 6c 61 | 74 65 72 2e 20 20 49 20 |02 or la|ter. I |
|00002750| 73 68 6f 75 6c 64 20 62 | 65 20 63 68 65 63 6b 69 |should b|e checki|
|00002760| 6e 67 20 66 6f 72 20 74 | 68 69 73 20 74 72 61 70 |ng for t|his trap|
|00002770| 20 74 6f 20 62 65 20 69 | 6d 70 6c 69 6d 65 6e 74 | to be i|mpliment|
|00002780| 65 64 2c 0d 09 2f 2f 20 | 62 75 74 20 49 20 61 6c |ed,..// |but I al|
|00002790| 73 6f 20 64 6f 6e 27 74 | 20 74 72 75 73 74 20 61 |so don't| trust a|
|000027a0| 6e 79 20 53 6f 75 6e 64 | 20 4d 61 6e 61 67 65 72 |ny Sound| Manager|
|000027b0| 20 74 68 61 74 20 77 61 | 73 20 73 68 69 70 70 65 | that wa|s shippe|
|000027c0| 64 20 70 72 69 76 6f 75 | 73 20 74 6f 20 36 2e 30 |d privou|s to 6.0|
|000027d0| 32 2e 0d 09 2f 2f 20 53 | 69 6e 63 65 20 49 20 63 |2...// S|ince I c|
|000027e0| 68 65 63 6b 65 64 20 66 | 6f 72 20 74 68 69 73 20 |hecked f|or this |
|000027f0| 76 65 72 73 69 6f 6e 20 | 6f 66 20 74 68 65 20 73 |version |of the s|
|00002800| 79 73 74 65 6d 20 49 20 | 6b 6e 6f 77 20 74 68 61 |ystem I |know tha|
|00002810| 74 20 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 20 |t WaitNe|xtEvent |
|00002820| 69 73 0d 09 2f 2f 20 74 | 68 65 72 65 2c 20 62 75 |is..// t|here, bu|
|00002830| 74 20 6f 74 68 65 72 77 | 69 73 65 20 49 20 77 6f |t otherw|ise I wo|
|00002840| 75 6c 64 20 62 65 20 63 | 68 65 63 6b 69 6e 67 20 |uld be c|hecking |
|00002850| 66 6f 72 20 74 68 65 20 | 66 65 61 74 75 72 65 73 |for the |features|
|00002860| 20 74 68 61 74 20 49 20 | 77 61 6e 74 0d 09 2f 2f | that I |want..//|
|00002870| 20 61 6e 64 20 6e 6f 74 | 20 66 6f 72 20 74 68 65 | and not| for the|
|00002880| 20 73 79 73 74 65 6d 20 | 76 65 72 73 69 6f 6e 2e | system |version.|
|00002890| 0d 0d 09 65 72 72 20 3d | 20 47 65 73 74 61 6c 74 |...err =| Gestalt|
|000028a0| 28 67 65 73 74 61 6c 74 | 53 79 73 74 65 6d 56 65 |(gestalt|SystemVe|
|000028b0| 72 73 69 6f 6e 2c 20 26 | 72 65 73 70 6f 6e 73 65 |rsion, &|response|
|000028c0| 29 3b 0d 09 69 66 20 28 | 65 72 72 20 21 3d 20 6e |);..if (|err != n|
|000028d0| 6f 45 72 72 29 0d 09 09 | 41 6c 65 72 74 55 73 65 |oErr)...|AlertUse|
|000028e0| 72 28 65 72 72 2c 20 65 | 53 79 73 74 65 6d 54 6f |r(err, e|SystemTo|
|000028f0| 6f 4f 6c 64 2c 20 6b 46 | 61 74 61 6c 45 72 72 6f |oOld, kF|atalErro|
|00002900| 72 29 3b 0d 09 65 6c 73 | 65 0d 09 09 69 66 20 28 |r);..els|e...if (|
|00002910| 72 65 73 70 6f 6e 73 65 | 20 3c 20 6b 4f 6c 64 65 |response| < kOlde|
|00002920| 73 74 53 79 73 74 65 6d | 41 6c 6c 6f 77 65 64 29 |stSystem|Allowed)|
|00002930| 0d 09 09 09 41 6c 65 72 | 74 55 73 65 72 28 65 72 |....Aler|tUser(er|
|00002940| 72 2c 20 65 53 79 73 74 | 65 6d 54 6f 6f 4f 6c 64 |r, eSyst|emTooOld|
|00002950| 2c 20 6b 46 61 74 61 6c | 45 72 72 6f 72 29 3b 0d |, kFatal|Error);.|
|00002960| 0d 0d 09 6d 65 6e 75 42 | 61 72 20 3d 20 47 65 74 |...menuB|ar = Get|
|00002970| 4e 65 77 4d 42 61 72 28 | 72 4d 65 6e 75 42 61 72 |NewMBar(|rMenuBar|
|00002980| 29 3b 0d 09 69 66 20 28 | 6d 65 6e 75 42 61 72 20 |);..if (|menuBar |
|00002990| 3d 3d 20 6e 69 6c 29 0d | 09 09 41 6c 65 72 74 55 |== nil).|..AlertU|
|000029a0| 73 65 72 28 4d 65 6d 45 | 72 72 6f 72 28 29 2c 20 |ser(MemE|rror(), |
|000029b0| 65 4e 6f 4d 65 6e 75 42 | 61 72 2c 20 6b 46 61 74 |eNoMenuB|ar, kFat|
|000029c0| 61 6c 45 72 72 6f 72 29 | 3b 0d 09 53 65 74 4d 65 |alError)|;..SetMe|
|000029d0| 6e 75 42 61 72 28 6d 65 | 6e 75 42 61 72 29 3b 0d |nuBar(me|nuBar);.|
|000029e0| 09 44 69 73 70 6f 73 48 | 61 6e 64 6c 65 28 6d 65 |.DisposH|andle(me|
|000029f0| 6e 75 42 61 72 29 3b 0d | 09 41 64 64 52 65 73 4d |nuBar);.|.AddResM|
|00002a00| 65 6e 75 28 47 65 74 4d | 48 61 6e 64 6c 65 28 6d |enu(GetM|Handle(m|
|00002a10| 41 70 70 6c 65 29 2c 20 | 27 44 52 56 52 27 29 3b |Apple), |'DRVR');|
|00002a20| 0d 09 44 72 61 77 4d 65 | 6e 75 42 61 72 28 29 3b |..DrawMe|nuBar();|
|00002a30| 0d 0d 09 4e 65 77 4d 61 | 69 6e 57 69 6e 64 6f 77 |...NewMa|inWindow|
|00002a40| 28 29 3b 0d 0d 09 65 72 | 72 20 3d 20 49 6e 69 74 |();...er|r = Init|
|00002a50| 44 6f 75 62 6c 65 42 75 | 66 66 65 72 28 29 3b 0d |DoubleBu|ffer();.|
|00002a60| 09 69 66 20 28 65 72 72 | 20 21 3d 20 6e 6f 45 72 |.if (err| != noEr|
|00002a70| 72 29 0d 09 09 41 6c 65 | 72 74 55 73 65 72 28 65 |r)...Ale|rtUser(e|
|00002a80| 72 72 2c 20 65 55 6e 65 | 78 70 65 63 74 65 64 2c |rr, eUne|xpected,|
|00002a90| 20 6b 46 61 74 61 6c 45 | 72 72 6f 72 29 3b 0d 0d | kFatalE|rror);..|
|00002aa0| 09 2f 2f 20 74 65 73 74 | 20 66 6f 72 20 6d 69 6e |.// test| for min|
|00002ab0| 69 6d 61 6c 20 6d 65 6d | 6f 72 79 20 72 65 71 75 |imal mem|ory requ|
|00002ac0| 69 72 65 6d 65 6e 74 73 | 20 61 66 74 65 72 20 61 |irements| after a|
|00002ad0| 6c 6c 6f 63 61 74 69 6e | 67 20 61 70 70 6c 69 63 |llocatin|g applic|
|00002ae0| 61 74 69 6f 6e 27 73 20 | 73 74 75 66 66 0d 09 69 |ation's |stuff..i|
|00002af0| 66 20 28 46 61 69 6c 4c | 6f 77 4d 65 6d 6f 72 79 |f (FailL|owMemory|
|00002b00| 28 6b 4d 69 6e 48 65 61 | 70 29 29 0d 09 09 41 6c |(kMinHea|p))...Al|
|00002b10| 65 72 74 55 73 65 72 28 | 30 2c 20 65 4e 6f 4d 65 |ertUser(|0, eNoMe|
|00002b20| 6d 6f 72 79 2c 20 6b 46 | 61 74 61 6c 45 72 72 6f |mory, kF|atalErro|
|00002b30| 72 29 3b 0d 09 09 0d 0d | 09 2f 2f 09 4d 61 6b 65 |r);.....|.//.Make|
|00002b40| 20 73 75 72 65 20 77 65 | 20 68 61 76 65 20 72 61 | sure we| have ra|
|00002b50| 74 69 6f 6e 61 6c 20 76 | 61 6c 75 65 73 20 66 6f |tional v|alues fo|
|00002b60| 72 20 74 68 65 20 61 6d | 70 6c 69 74 75 64 65 20 |r the am|plitude |
|00002b70| 61 6e 64 20 70 69 74 63 | 68 20 67 6c 6f 62 61 6c |and pitc|h global|
|00002b80| 73 2e 0d 09 67 50 69 74 | 63 68 20 3d 20 6b 50 69 |s...gPit|ch = kPi|
|00002b90| 74 63 68 44 65 66 61 75 | 6c 74 3b 0d 09 67 41 6d |tchDefau|lt;..gAm|
|00002ba0| 70 6c 69 74 75 64 65 20 | 3d 20 6b 41 6d 70 44 65 |plitude |= kAmpDe|
|00002bb0| 66 61 75 6c 74 3b 0d 09 | 0d 09 2f 2f 09 44 6f 6e |fault;..|..//.Don|
|00002bc0| 27 74 20 6e 65 65 64 20 | 61 20 77 61 76 65 20 74 |'t need |a wave t|
|00002bd0| 61 62 6c 65 20 75 6e 74 | 69 6c 20 61 73 6b 65 64 |able unt|il asked|
|00002be0| 20 66 6f 72 20 69 74 2e | 2e 2e 0d 09 67 55 70 64 | for it.|....gUpd|
|00002bf0| 61 74 65 57 61 76 65 20 | 3d 20 66 61 6c 73 65 3b |ateWave |= false;|
|00002c00| 0d 7d 0d 0d 2f 2f 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.}..//~~|~~~~~~~~|
|00002c10| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002c20| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002c30| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002c40| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002c50| 7e 7e 7e 7e 7e 7e 0d 2f | 2f 20 43 68 65 63 6b 20 |~~~~~~./|/ Check |
|00002c60| 74 6f 20 73 65 65 20 69 | 66 20 61 20 77 69 6e 64 |to see i|f a wind|
|00002c70| 6f 77 20 62 65 6c 6f 6e | 67 73 20 74 6f 20 61 20 |ow belon|gs to a |
|00002c80| 64 65 73 6b 20 61 63 63 | 65 73 73 6f 72 79 2e 0d |desk acc|essory..|
|00002c90| 0d 42 6f 6f 6c 65 61 6e | 09 49 73 44 41 57 69 6e |.Boolean|.IsDAWin|
|00002ca0| 64 6f 77 28 57 69 6e 64 | 6f 77 50 74 72 20 77 69 |dow(Wind|owPtr wi|
|00002cb0| 6e 64 6f 77 29 0d 7b 0d | 09 69 66 20 28 77 69 6e |ndow).{.|.if (win|
|00002cc0| 64 6f 77 29 09 09 09 09 | 09 09 09 09 2f 2f 20 44 |dow)....|....// D|
|00002cd0| 41 20 77 69 6e 64 6f 77 | 73 20 68 61 76 65 20 6e |A window|s have n|
|00002ce0| 65 67 61 74 69 76 65 20 | 77 69 6e 64 6f 77 4b 69 |egative |windowKi|
|00002cf0| 6e 64 73 0d 09 09 72 65 | 74 75 72 6e 20 28 28 28 |nds...re|turn (((|
|00002d00| 57 69 6e 64 6f 77 50 65 | 65 6b 29 20 77 69 6e 64 |WindowPe|ek) wind|
|00002d10| 6f 77 29 2d 3e 77 69 6e | 64 6f 77 4b 69 6e 64 20 |ow)->win|dowKind |
|00002d20| 3c 20 30 29 3b 0d 09 65 | 6c 73 65 0d 09 09 72 65 |< 0);..e|lse...re|
|00002d30| 74 75 72 6e 20 66 61 6c | 73 65 3b 0d 7d 0d 0d 2f |turn fal|se;.}../|
|00002d40| 2f 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |/~~~~~~~|~~~~~~~~|
|00002d50| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002d60| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002d70| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002d80| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002d90| 7e 0d 2f 2f 09 43 61 6c | 63 75 6c 61 74 65 20 61 |~.//.Cal|culate a|
|00002da0| 20 73 6c 65 65 70 20 76 | 61 6c 75 65 20 66 6f 72 | sleep v|alue for|
|00002db0| 20 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 2e 20 | WaitNex|tEvent. |
|00002dc0| 54 68 69 73 20 74 61 6b | 65 73 20 69 6e 74 6f 20 |This tak|es into |
|00002dd0| 61 63 63 6f 75 6e 74 20 | 74 68 65 20 74 68 69 6e |account |the thin|
|00002de0| 67 73 0d 2f 2f 09 74 68 | 61 74 20 44 6f 49 64 6c |gs.//.th|at DoIdl|
|00002df0| 65 20 64 6f 65 73 20 77 | 69 74 68 20 69 64 6c 65 |e does w|ith idle|
|00002e00| 20 74 69 6d 65 2e 0d 20 | 0d 6c 6f 6e 67 20 47 65 | time.. |.long Ge|
|00002e10| 74 53 6c 65 65 70 28 76 | 6f 69 64 29 0d 7b 0d 09 |tSleep(v|oid).{..|
|00002e20| 69 66 20 28 67 49 6e 42 | 61 63 6b 67 72 6f 75 6e |if (gInB|ackgroun|
|00002e30| 64 29 0d 09 09 72 65 74 | 75 72 6e 20 28 6b 42 61 |d)...ret|urn (kBa|
|00002e40| 63 6b 53 6c 65 65 70 29 | 3b 0d 09 65 6c 73 65 0d |ckSleep)|;..else.|
|00002e50| 09 09 72 65 74 75 72 6e | 20 28 6b 46 6f 72 65 53 |..return| (kForeS|
|00002e60| 6c 65 65 70 29 3b 0d 7d | 0d 0d 2f 2f 7e 7e 7e 7e |leep);.}|..//~~~~|
|00002e70| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002e80| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002e90| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002ea0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00002eb0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 0d 76 6f 69 |~~~~~~~~|~~~~.voi|
|00002ec0| 64 20 44 6f 49 64 6c 65 | 28 76 6f 69 64 29 0d 7b |d DoIdle|(void).{|
|00002ed0| 0d 09 57 69 6e 64 6f 77 | 50 74 72 09 09 77 69 6e |..Window|Ptr..win|
|00002ee0| 64 6f 77 3b 0d 09 57 61 | 76 65 43 79 63 6c 65 50 |dow;..Wa|veCycleP|
|00002ef0| 74 72 09 77 61 76 65 3b | 0d 09 6c 6f 6e 67 09 09 |tr.wave;|..long..|
|00002f00| 09 66 69 6e 61 6c 54 69 | 63 6b 3b 0d 0d 09 77 69 |.finalTi|ck;...wi|
|00002f10| 6e 64 6f 77 20 3d 20 46 | 72 6f 6e 74 57 69 6e 64 |ndow = F|rontWind|
|00002f20| 6f 77 28 29 3b 0d 09 0d | 09 69 66 20 28 67 55 70 |ow();...|.if (gUp|
|00002f30| 64 61 74 65 57 61 76 65 | 20 3d 3d 20 74 72 75 65 |dateWave| == true|
|00002f40| 29 20 7b 0d 09 09 2f 2f | 20 53 68 6f 75 6c 64 20 |) {...//| Should |
|00002f50| 70 72 6f 62 61 62 6c 79 | 20 73 65 74 20 61 20 77 |probably| set a w|
|00002f60| 61 74 63 68 20 63 75 72 | 73 6f 72 20 68 65 72 65 |atch cur|sor here|
|00002f70| 2e 2e 2e 0d 0d 09 09 77 | 61 76 65 20 3d 20 4e 65 |.......w|ave = Ne|
|00002f80| 77 57 61 76 65 46 6f 72 | 6d 20 28 67 41 6d 70 6c |wWaveFor|m (gAmpl|
|00002f90| 69 74 75 64 65 2c 67 50 | 69 74 63 68 29 3b 0d 09 |itude,gP|itch);..|
|00002fa0| 09 0d 09 09 4b 69 6c 6c | 44 6f 75 62 6c 65 42 75 |....Kill|DoubleBu|
|00002fb0| 66 66 65 72 20 28 29 3b | 09 09 09 09 09 09 09 09 |ffer ();|........|
|00002fc0| 2f 2f 20 73 74 6f 70 20 | 63 75 72 72 65 6e 74 20 |// stop |current |
|00002fd0| 70 6c 61 79 20 61 6e 64 | 0d 0d 09 09 46 72 65 65 |play and|....Free|
|00002fe0| 44 42 50 72 69 76 61 74 | 65 4d 65 6d 20 28 67 50 |DBPrivat|eMem (gP|
|00002ff0| 72 69 76 61 74 65 50 74 | 72 29 3b 09 09 09 09 09 |rivatePt|r);.....|
|00003000| 09 2f 2f 20 72 65 6c 65 | 61 73 65 20 69 74 27 73 |.// rele|ase it's|
|00003010| 20 6d 65 6d 6f 72 79 0d | 09 09 0d 09 09 44 65 6c | memory.|.....Del|
|00003020| 61 79 20 28 32 30 2c 20 | 26 66 69 6e 61 6c 54 69 |ay (20, |&finalTi|
|00003030| 63 6b 29 3b 09 09 09 09 | 09 09 09 09 2f 2f 20 4c |ck);....|....// L|
|00003040| 65 74 20 63 75 72 72 65 | 6e 74 20 70 6c 61 79 20 |et curre|nt play |
|00003050| 63 6f 6d 70 6c 65 74 65 | 0d 0d 09 09 50 6c 61 79 |complete|....Play|
|00003060| 57 61 76 65 20 28 38 38 | 30 30 30 2c 20 77 61 76 |Wave (88|000, wav|
|00003070| 65 2c 20 26 67 50 72 69 | 76 61 74 65 50 74 72 29 |e, &gPri|vatePtr)|
|00003080| 3b 09 09 09 09 2f 2f 09 | 41 62 6f 75 74 20 66 6f |;....//.|About fo|
|00003090| 75 72 20 73 65 63 6f 6e | 64 73 2e 2e 2e 0d 09 09 |ur secon|ds......|
|000030a0| 0d 09 09 67 55 70 64 61 | 74 65 57 61 76 65 20 3d |...gUpda|teWave =|
|000030b0| 20 66 61 6c 73 65 3b 0d | 09 7d 09 0d 7d 0d 0d 2f | false;.|.}..}../|
|000030c0| 2f 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |/~~~~~~~|~~~~~~~~|
|000030d0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000030e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000030f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003100| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003110| 7e 0d 42 6f 6f 6c 65 61 | 6e 20 46 61 69 6c 4c 6f |~.Boolea|n FailLo|
|00003120| 77 4d 65 6d 6f 72 79 28 | 6c 6f 6e 67 20 6d 65 6d |wMemory(|long mem|
|00003130| 52 65 71 75 65 73 74 65 | 64 29 0d 7b 0d 09 6c 6f |Requeste|d).{..lo|
|00003140| 6e 67 09 09 74 6f 74 61 | 6c 3b 0d 09 6c 6f 6e 67 |ng..tota|l;..long|
|00003150| 09 09 63 6f 6e 74 69 67 | 3b 0d 0d 09 50 75 72 67 |..contig|;...Purg|
|00003160| 65 53 70 61 63 65 28 26 | 74 6f 74 61 6c 2c 20 26 |eSpace(&|total, &|
|00003170| 63 6f 6e 74 69 67 29 3b | 0d 09 72 65 74 75 72 6e |contig);|..return|
|00003180| 20 28 20 74 6f 74 61 6c | 20 3c 20 28 6d 65 6d 52 | ( total| < (memR|
|00003190| 65 71 75 65 73 74 65 64 | 20 2b 20 6b 4d 69 6e 53 |equested| + kMinS|
|000031a0| 70 61 63 65 29 20 29 3b | 0d 7d 0d 0d 2f 2f 7e 7e |pace) );|.}..//~~|
|000031b0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000031c0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000031d0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000031e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000031f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 0d 76 |~~~~~~~~|~~~~~~.v|
|00003200| 6f 69 64 20 41 6c 65 72 | 74 55 73 65 72 28 73 68 |oid Aler|tUser(sh|
|00003210| 6f 72 74 20 65 72 72 4e | 75 6d 2c 20 73 68 6f 72 |ort errN|um, shor|
|00003220| 74 20 65 72 72 53 74 72 | 49 6e 64 65 78 2c 20 42 |t errStr|Index, B|
|00003230| 6f 6f 6c 65 61 6e 20 66 | 61 74 61 6c 29 0d 7b 0d |oolean f|atal).{.|
|00003240| 09 73 68 6f 72 74 09 09 | 69 74 65 6d 48 69 74 3b |.short..|itemHit;|
|00003250| 0d 09 53 74 72 32 35 35 | 09 09 6d 73 67 31 3b 0d |..Str255|..msg1;.|
|00003260| 09 53 74 72 32 35 35 09 | 09 6d 73 67 32 3b 0d 0d |.Str255.|.msg2;..|
|00003270| 09 69 66 20 28 65 72 72 | 4e 75 6d 20 21 3d 20 75 |.if (err|Num != u|
|00003280| 73 65 72 43 61 6e 63 65 | 6c 65 64 45 72 72 29 20 |serCance|ledErr) |
|00003290| 7b 09 09 09 09 09 09 2f | 2f 20 69 67 6e 6f 72 65 |{....../|/ ignore|
|000032a0| 20 63 61 6e 63 65 6c 73 | 0d 09 09 53 65 74 43 75 | cancels|...SetCu|
|000032b0| 72 73 6f 72 28 26 71 64 | 2e 61 72 72 6f 77 29 3b |rsor(&qd|.arrow);|
|000032c0| 0d 09 09 69 66 20 28 65 | 72 72 4e 75 6d 29 0d 09 |...if (e|rrNum)..|
|000032d0| 09 09 4e 75 6d 54 6f 53 | 74 72 69 6e 67 28 65 72 |..NumToS|tring(er|
|000032e0| 72 4e 75 6d 2c 20 6d 73 | 67 31 29 3b 0d 09 09 65 |rNum, ms|g1);...e|
|000032f0| 6c 73 65 0d 09 09 09 2a | 6d 73 67 31 20 3d 20 30 |lse....*|msg1 = 0|
|00003300| 3b 09 09 09 09 09 09 09 | 09 09 09 2f 2f 20 73 65 |;.......|...// se|
|00003310| 74 20 6c 65 6e 67 74 68 | 20 74 6f 20 7a 65 72 6f |t length| to zero|
|00003320| 0d 09 09 47 65 74 49 6e | 64 53 74 72 69 6e 67 28 |...GetIn|dString(|
|00003330| 6d 73 67 32 2c 20 72 45 | 72 72 53 74 72 69 6e 67 |msg2, rE|rrString|
|00003340| 73 2c 20 65 72 72 53 74 | 72 49 6e 64 65 78 29 3b |s, errSt|rIndex);|
|00003350| 0d 09 09 50 61 72 61 6d | 54 65 78 74 28 6d 73 67 |...Param|Text(msg|
|00003360| 31 2c 20 6d 73 67 32 2c | 20 22 5c 70 22 2c 20 22 |1, msg2,| "\p", "|
|00003370| 5c 70 22 29 3b 0d 09 09 | 69 74 65 6d 48 69 74 20 |\p");...|itemHit |
|00003380| 3d 20 41 6c 65 72 74 28 | 72 55 73 65 72 41 6c 65 |= Alert(|rUserAle|
|00003390| 72 74 2c 20 6e 69 6c 29 | 3b 0d 09 09 69 66 20 28 |rt, nil)|;...if (|
|000033a0| 66 61 74 61 6c 29 0d 09 | 09 09 45 78 69 74 54 6f |fatal)..|..ExitTo|
|000033b0| 53 68 65 6c 6c 28 29 3b | 0d 09 7d 0d 7d 0d 0d 2f |Shell();|..}.}../|
|000033c0| 2f 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |/~~~~~~~|~~~~~~~~|
|000033d0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000033e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000033f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003400| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003410| 7e 0d 76 6f 69 64 20 4e | 65 77 4d 61 69 6e 57 69 |~.void N|ewMainWi|
|00003420| 6e 64 6f 77 28 76 6f 69 | 64 29 0d 7b 0d 09 43 6f |ndow(voi|d).{..Co|
|00003430| 6e 74 72 6f 6c 48 61 6e | 64 6c 65 09 63 6f 6e 74 |ntrolHan|dle.cont|
|00003440| 72 6f 6c 3b 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |rol;..Wi|ndowPtr.|
|00003450| 09 77 69 6e 64 6f 77 3b | 0d 09 53 74 72 69 6e 67 |.window;|..String|
|00003460| 48 61 6e 64 6c 65 09 73 | 74 72 48 61 6e 64 6c 65 |Handle.s|trHandle|
|00003470| 3b 0d 0d 09 77 69 6e 64 | 6f 77 20 3d 20 28 57 69 |;...wind|ow = (Wi|
|00003480| 6e 64 6f 77 50 74 72 29 | 20 4e 65 77 50 74 72 28 |ndowPtr)| NewPtr(|
|00003490| 73 69 7a 65 6f 66 28 4d | 61 69 6e 57 69 6e 64 6f |sizeof(M|ainWindo|
|000034a0| 77 29 29 3b 0d 09 69 66 | 20 28 77 69 6e 64 6f 77 |w));..if| (window|
|000034b0| 20 3d 3d 20 6e 69 6c 29 | 0d 09 09 41 6c 65 72 74 | == nil)|...Alert|
|000034c0| 55 73 65 72 28 4d 65 6d | 45 72 72 6f 72 28 29 2c |User(Mem|Error(),|
|000034d0| 20 65 4e 6f 57 69 6e 64 | 6f 77 2c 20 6b 46 61 74 | eNoWind|ow, kFat|
|000034e0| 61 6c 45 72 72 6f 72 29 | 3b 0d 09 77 69 6e 64 6f |alError)|;..windo|
|000034f0| 77 20 3d 20 47 65 74 4e | 65 77 57 69 6e 64 6f 77 |w = GetN|ewWindow|
|00003500| 28 72 4d 61 69 6e 57 69 | 6e 64 6f 77 2c 20 77 69 |(rMainWi|ndow, wi|
|00003510| 6e 64 6f 77 2c 20 28 57 | 69 6e 64 6f 77 50 74 72 |ndow, (W|indowPtr|
|00003520| 29 2d 31 29 3b 0d 09 69 | 66 20 28 77 69 6e 64 6f |)-1);..i|f (windo|
|00003530| 77 20 3d 3d 20 6e 69 6c | 29 0d 09 09 41 6c 65 72 |w == nil|)...Aler|
|00003540| 74 55 73 65 72 28 4d 65 | 6d 45 72 72 6f 72 28 29 |tUser(Me|mError()|
|00003550| 2c 20 65 4e 6f 57 69 6e | 64 6f 77 2c 20 6b 46 61 |, eNoWin|dow, kFa|
|00003560| 74 61 6c 45 72 72 6f 72 | 29 3b 0d 09 53 65 74 50 |talError|);..SetP|
|00003570| 6f 72 74 28 77 69 6e 64 | 6f 77 29 3b 0d 09 54 65 |ort(wind|ow);..Te|
|00003580| 78 74 46 6f 6e 74 28 73 | 79 73 74 65 6d 46 6f 6e |xtFont(s|ystemFon|
|00003590| 74 29 3b 0d 09 53 65 74 | 57 52 65 66 43 6f 6e 28 |t);..Set|WRefCon(|
|000035a0| 77 69 6e 64 6f 77 2c 20 | 72 4d 61 69 6e 57 69 6e |window, |rMainWin|
|000035b0| 64 6f 77 29 3b 0d 0d 09 | 63 6f 6e 74 72 6f 6c 20 |dow);...|control |
|000035c0| 3d 20 47 65 74 4e 65 77 | 43 6f 6e 74 72 6f 6c 28 |= GetNew|Control(|
|000035d0| 72 41 6d 70 42 75 74 74 | 6f 6e 2c 20 77 69 6e 64 |rAmpButt|on, wind|
|000035e0| 6f 77 29 3b 0d 09 69 66 | 20 28 63 6f 6e 74 72 6f |ow);..if| (contro|
|000035f0| 6c 20 3d 3d 20 6e 69 6c | 29 0d 09 09 41 6c 65 72 |l == nil|)...Aler|
|00003600| 74 55 73 65 72 28 4d 65 | 6d 45 72 72 6f 72 28 29 |tUser(Me|mError()|
|00003610| 2c 20 65 4e 6f 57 69 6e | 64 6f 77 2c 20 6b 46 61 |, eNoWin|dow, kFa|
|00003620| 74 61 6c 45 72 72 6f 72 | 29 3b 0d 09 53 65 74 43 |talError|);..SetC|
|00003630| 52 65 66 43 6f 6e 28 63 | 6f 6e 74 72 6f 6c 2c 20 |RefCon(c|ontrol, |
|00003640| 72 41 6d 70 42 75 74 74 | 6f 6e 29 3b 0d 0d 09 63 |rAmpButt|on);...c|
|00003650| 6f 6e 74 72 6f 6c 20 3d | 20 47 65 74 4e 65 77 43 |ontrol =| GetNewC|
|00003660| 6f 6e 74 72 6f 6c 28 72 | 50 69 74 63 68 42 75 74 |ontrol(r|PitchBut|
|00003670| 74 6f 6e 2c 20 77 69 6e | 64 6f 77 29 3b 0d 09 69 |ton, win|dow);..i|
|00003680| 66 20 28 63 6f 6e 74 72 | 6f 6c 20 3d 3d 20 6e 69 |f (contr|ol == ni|
|00003690| 6c 29 0d 09 09 41 6c 65 | 72 74 55 73 65 72 28 4d |l)...Ale|rtUser(M|
|000036a0| 65 6d 45 72 72 6f 72 28 | 29 2c 20 65 4e 6f 57 69 |emError(|), eNoWi|
|000036b0| 6e 64 6f 77 2c 20 6b 46 | 61 74 61 6c 45 72 72 6f |ndow, kF|atalErro|
|000036c0| 72 29 3b 0d 09 53 65 74 | 43 52 65 66 43 6f 6e 28 |r);..Set|CRefCon(|
|000036d0| 63 6f 6e 74 72 6f 6c 2c | 20 72 50 69 74 63 68 42 |control,| rPitchB|
|000036e0| 75 74 74 6f 6e 29 3b 0d | 0d 09 73 74 72 48 61 6e |utton);.|..strHan|
|000036f0| 64 6c 65 20 3d 20 47 65 | 74 53 74 72 69 6e 67 28 |dle = Ge|tString(|
|00003700| 72 41 6d 70 53 74 72 69 | 6e 67 29 3b 0d 09 69 66 |rAmpStri|ng);..if|
|00003710| 20 28 73 74 72 48 61 6e | 64 6c 65 20 3d 3d 20 6e | (strHan|dle == n|
|00003720| 69 6c 29 0d 09 09 41 6c | 65 72 74 55 73 65 72 28 |il)...Al|ertUser(|
|00003730| 52 65 73 45 72 72 6f 72 | 28 29 2c 20 65 52 65 73 |ResError|(), eRes|
|00003740| 6f 75 72 63 65 45 72 72 | 2c 20 6b 46 61 74 61 6c |ourceErr|, kFatal|
|00003750| 45 72 72 6f 72 29 3b 0d | 09 28 28 4d 61 69 6e 57 |Error);.|.((MainW|
|00003760| 69 6e 64 6f 77 50 74 72 | 29 77 69 6e 64 6f 77 29 |indowPtr|)window)|
|00003770| 2d 3e 61 6d 70 53 74 72 | 69 6e 67 20 3d 20 73 74 |->ampStr|ing = st|
|00003780| 72 48 61 6e 64 6c 65 3b | 0d 0d 09 73 74 72 48 61 |rHandle;|...strHa|
|00003790| 6e 64 6c 65 20 3d 20 47 | 65 74 53 74 72 69 6e 67 |ndle = G|etString|
|000037a0| 28 72 50 69 74 63 68 53 | 74 72 69 6e 67 29 3b 0d |(rPitchS|tring);.|
|000037b0| 09 69 66 20 28 73 74 72 | 48 61 6e 64 6c 65 20 3d |.if (str|Handle =|
|000037c0| 3d 20 6e 69 6c 29 0d 09 | 09 41 6c 65 72 74 55 73 |= nil)..|.AlertUs|
|000037d0| 65 72 28 52 65 73 45 72 | 72 6f 72 28 29 2c 20 65 |er(ResEr|ror(), e|
|000037e0| 52 65 73 6f 75 72 63 65 | 45 72 72 2c 20 6b 46 61 |Resource|Err, kFa|
|000037f0| 74 61 6c 45 72 72 6f 72 | 29 3b 0d 09 28 28 4d 61 |talError|);..((Ma|
|00003800| 69 6e 57 69 6e 64 6f 77 | 50 74 72 29 77 69 6e 64 |inWindow|Ptr)wind|
|00003810| 6f 77 29 2d 3e 70 69 74 | 63 68 53 74 72 69 6e 67 |ow)->pit|chString|
|00003820| 20 3d 20 73 74 72 48 61 | 6e 64 6c 65 3b 0d 0d 09 | = strHa|ndle;...|
|00003830| 53 68 6f 77 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |ShowWind|ow(windo|
|00003840| 77 29 3b 0d 7d 0d 0d 2f | 2f 7e 7e 7e 7e 7e 7e 7e |w);.}../|/~~~~~~~|
|00003850| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003860| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003870| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003880| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003890| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 0d 76 6f 69 64 20 44 |~~~~~~~~|~.void D|
|000038a0| 72 61 77 4d 61 69 6e 57 | 69 6e 64 6f 77 28 57 69 |rawMainW|indow(Wi|
|000038b0| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 29 0d |ndowPtr |window).|
|000038c0| 7b 0d 09 43 6f 6e 74 72 | 6f 6c 48 61 6e 64 6c 65 |{..Contr|olHandle|
|000038d0| 09 63 6f 6e 74 72 6f 6c | 3b 0d 09 52 65 63 74 09 |.control|;..Rect.|
|000038e0| 09 09 64 72 61 77 41 72 | 65 61 3b 0d 0d 09 55 70 |..drawAr|ea;...Up|
|000038f0| 64 61 74 65 43 6f 6e 74 | 72 6f 6c 73 28 77 69 6e |dateCont|rols(win|
|00003900| 64 6f 77 2c 20 77 69 6e | 64 6f 77 2d 3e 76 69 73 |dow, win|dow->vis|
|00003910| 52 67 6e 29 3b 0d 09 63 | 6f 6e 74 72 6f 6c 20 3d |Rgn);..c|ontrol =|
|00003920| 20 46 69 6e 64 4d 79 43 | 6f 6e 74 72 6f 6c 28 77 | FindMyC|ontrol(w|
|00003930| 69 6e 64 6f 77 2c 20 72 | 41 6d 70 42 75 74 74 6f |indow, r|AmpButto|
|00003940| 6e 29 3b 0d 09 69 66 20 | 28 63 6f 6e 74 72 6f 6c |n);..if |(control|
|00003950| 20 21 3d 20 6e 69 6c 29 | 20 7b 0d 09 09 64 72 61 | != nil)| {...dra|
|00003960| 77 41 72 65 61 20 3d 20 | 28 2a 2a 63 6f 6e 74 72 |wArea = |(**contr|
|00003970| 6f 6c 29 2e 63 6f 6e 74 | 72 6c 52 65 63 74 3b 0d |ol).cont|rlRect;.|
|00003980| 09 09 4f 66 66 73 65 74 | 52 65 63 74 28 26 64 72 |..Offset|Rect(&dr|
|00003990| 61 77 41 72 65 61 2c 20 | 30 2c 20 6b 43 6f 6e 74 |awArea, |0, kCont|
|000039a0| 72 6f 6c 54 65 78 74 4f | 66 66 73 65 74 29 3b 0d |rolTextO|ffset);.|
|000039b0| 09 09 54 65 78 74 42 6f | 78 28 2a 28 28 4d 61 69 |..TextBo|x(*((Mai|
|000039c0| 6e 57 69 6e 64 6f 77 50 | 74 72 29 77 69 6e 64 6f |nWindowP|tr)windo|
|000039d0| 77 29 2d 3e 61 6d 70 53 | 74 72 69 6e 67 20 2b 20 |w)->ampS|tring + |
|000039e0| 31 2c 0d 09 09 09 09 09 | 4c 65 6e 67 74 68 28 2a |1,......|Length(*|
|000039f0| 28 28 4d 61 69 6e 57 69 | 6e 64 6f 77 50 74 72 29 |((MainWi|ndowPtr)|
|00003a00| 77 69 6e 64 6f 77 29 2d | 3e 61 6d 70 53 74 72 69 |window)-|>ampStri|
|00003a10| 6e 67 29 2c 20 26 64 72 | 61 77 41 72 65 61 2c 20 |ng), &dr|awArea, |
|00003a20| 74 65 4a 75 73 74 43 65 | 6e 74 65 72 29 3b 0d 09 |teJustCe|nter);..|
|00003a30| 7d 0d 09 63 6f 6e 74 72 | 6f 6c 20 3d 20 46 69 6e |}..contr|ol = Fin|
|00003a40| 64 4d 79 43 6f 6e 74 72 | 6f 6c 28 77 69 6e 64 6f |dMyContr|ol(windo|
|00003a50| 77 2c 20 72 50 69 74 63 | 68 42 75 74 74 6f 6e 29 |w, rPitc|hButton)|
|00003a60| 3b 0d 09 69 66 20 28 63 | 6f 6e 74 72 6f 6c 20 21 |;..if (c|ontrol !|
|00003a70| 3d 20 6e 69 6c 29 20 7b | 0d 09 09 64 72 61 77 41 |= nil) {|...drawA|
|00003a80| 72 65 61 20 3d 20 28 2a | 2a 63 6f 6e 74 72 6f 6c |rea = (*|*control|
|00003a90| 29 2e 63 6f 6e 74 72 6c | 52 65 63 74 3b 0d 09 09 |).contrl|Rect;...|
|00003aa0| 4f 66 66 73 65 74 52 65 | 63 74 28 26 64 72 61 77 |OffsetRe|ct(&draw|
|00003ab0| 41 72 65 61 2c 20 30 2c | 20 6b 43 6f 6e 74 72 6f |Area, 0,| kContro|
|00003ac0| 6c 54 65 78 74 4f 66 66 | 73 65 74 29 3b 0d 09 09 |lTextOff|set);...|
|00003ad0| 54 65 78 74 42 6f 78 28 | 2a 28 28 4d 61 69 6e 57 |TextBox(|*((MainW|
|00003ae0| 69 6e 64 6f 77 50 74 72 | 29 77 69 6e 64 6f 77 29 |indowPtr|)window)|
|00003af0| 2d 3e 70 69 74 63 68 53 | 74 72 69 6e 67 20 2b 20 |->pitchS|tring + |
|00003b00| 31 2c 0d 09 09 09 09 09 | 4c 65 6e 67 74 68 28 2a |1,......|Length(*|
|00003b10| 28 28 4d 61 69 6e 57 69 | 6e 64 6f 77 50 74 72 29 |((MainWi|ndowPtr)|
|00003b20| 77 69 6e 64 6f 77 29 2d | 3e 70 69 74 63 68 53 74 |window)-|>pitchSt|
|00003b30| 72 69 6e 67 29 2c 20 26 | 64 72 61 77 41 72 65 61 |ring), &|drawArea|
|00003b40| 2c 20 74 65 4a 75 73 74 | 43 65 6e 74 65 72 29 3b |, teJust|Center);|
|00003b50| 0d 09 7d 0d 7d 0d 0d 2f | 2f 7e 7e 7e 7e 7e 7e 7e |..}.}../|/~~~~~~~|
|00003b60| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003b70| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003b80| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003b90| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00003ba0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 0d 76 6f 69 64 20 4d |~~~~~~~~|~.void M|
|00003bb0| 61 69 6e 57 69 6e 64 6f | 77 43 6c 69 63 6b 28 57 |ainWindo|wClick(W|
|00003bc0| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 2c |indowPtr| window,|
|00003bd0| 20 45 76 65 6e 74 52 65 | 63 6f 72 64 20 2a 65 76 | EventRe|cord *ev|
|00003be0| 65 6e 74 29 0d 7b 0d 09 | 50 6f 69 6e 74 09 09 09 |ent).{..|Point...|
|00003bf0| 6d 6f 75 73 65 3b 0d 09 | 43 6f 6e 74 72 6f 6c 48 |mouse;..|ControlH|
|00003c00| 61 6e 64 6c 65 09 63 6f | 6e 74 72 6f 6c 3b 0d 09 |andle.co|ntrol;..|
|00003c10| 73 68 6f 72 74 09 09 09 | 70 61 72 74 3b 0d 09 73 |short...|part;..s|
|00003c20| 68 6f 72 74 09 09 09 6f | 6c 64 56 61 6c 75 65 3b |hort...o|ldValue;|
|00003c30| 0d 0d 09 53 65 74 50 6f | 72 74 28 77 69 6e 64 6f |...SetPo|rt(windo|
|00003c40| 77 29 3b 0d 09 6d 6f 75 | 73 65 20 3d 20 65 76 65 |w);..mou|se = eve|
|00003c50| 6e 74 2d 3e 77 68 65 72 | 65 3b 09 09 09 09 09 09 |nt->wher|e;......|
|00003c60| 09 2f 2f 20 67 65 74 20 | 74 68 65 20 63 6c 69 63 |.// get |the clic|
|00003c70| 6b 20 70 6f 73 69 74 69 | 6f 6e 0d 09 47 6c 6f 62 |k positi|on..Glob|
|00003c80| 61 6c 54 6f 4c 6f 63 61 | 6c 28 26 6d 6f 75 73 65 |alToLoca|l(&mouse|
|00003c90| 29 3b 0d 0d 09 70 61 72 | 74 20 3d 20 46 69 6e 64 |);...par|t = Find|
|00003ca0| 43 6f 6e 74 72 6f 6c 28 | 6d 6f 75 73 65 2c 20 77 |Control(|mouse, w|
|00003cb0| 69 6e 64 6f 77 2c 20 26 | 63 6f 6e 74 72 6f 6c 29 |indow, &|control)|
|00003cc0| 3b 0d 09 69 66 20 28 70 | 61 72 74 20 21 3d 20 30 |;..if (p|art != 0|
|00003cd0| 29 20 7b 09 09 09 09 09 | 09 09 09 2f 2f 20 63 68 |) {.....|...// ch|
|00003ce0| 65 63 6b 20 66 6f 72 20 | 61 20 68 69 74 0d 0d 09 |eck for |a hit...|
|00003cf0| 09 73 77 69 74 63 68 20 | 28 47 65 74 43 52 65 66 |.switch |(GetCRef|
|00003d00| 43 6f 6e 28 63 6f 6e 74 | 72 6f 6c 29 29 20 7b 0d |Con(cont|rol)) {.|
|00003d10| 0d 09 09 09 63 61 73 65 | 20 72 41 6d 70 42 75 74 |....case| rAmpBut|
|00003d20| 74 6f 6e 3a 0d 09 09 09 | 09 69 66 20 28 70 61 72 |ton:....|.if (par|
|00003d30| 74 20 3d 3d 20 69 6e 54 | 68 75 6d 62 29 0d 09 09 |t == inT|humb)...|
|00003d40| 09 09 09 54 72 61 63 6b | 43 6f 6e 74 72 6f 6c 28 |...Track|Control(|
|00003d50| 63 6f 6e 74 72 6f 6c 2c | 20 6d 6f 75 73 65 2c 20 |control,| mouse, |
|00003d60| 6e 69 6c 29 3b 0d 09 09 | 09 09 65 6c 73 65 0d 09 |nil);...|..else..|
|00003d70| 09 09 09 09 54 72 61 63 | 6b 43 6f 6e 74 72 6f 6c |....Trac|kControl|
|00003d80| 28 63 6f 6e 74 72 6f 6c | 2c 20 6d 6f 75 73 65 2c |(control|, mouse,|
|00003d90| 20 28 50 72 6f 63 50 74 | 72 29 53 63 72 6f 6c 6c | (ProcPt|r)Scroll|
|00003da0| 41 64 6a 75 73 74 29 3b | 0d 09 09 09 09 6f 6c 64 |Adjust);|.....old|
|00003db0| 56 61 6c 75 65 20 3d 20 | 67 41 6d 70 6c 69 74 75 |Value = |gAmplitu|
|00003dc0| 64 65 3b 09 09 09 09 2f | 2f 20 73 61 76 65 20 61 |de;..../|/ save a|
|00003dd0| 6d 70 6c 69 74 75 64 65 | 20 76 61 6c 75 65 0d 09 |mplitude| value..|
|00003de0| 09 09 09 67 41 6d 70 6c | 69 74 75 64 65 20 20 3d |...gAmpl|itude =|
|00003df0| 20 47 65 74 43 74 6c 56 | 61 6c 75 65 28 63 6f 6e | GetCtlV|alue(con|
|00003e00| 74 72 6f 6c 29 3b 0d 09 | 09 09 09 0d 09 09 09 09 |trol);..|........|
|00003e10| 2f 2f 09 53 69 6e 63 65 | 20 72 65 63 61 6c 63 75 |//.Since| recalcu|
|00003e20| 6c 61 74 69 6e 67 20 74 | 68 65 20 77 61 76 65 20 |lating t|he wave |
|00003e30| 66 6f 72 6d 20 6d 61 79 | 20 74 61 6b 65 20 61 20 |form may| take a |
|00003e40| 77 68 69 6c 65 2c 20 6d | 61 6b 65 20 73 75 72 65 |while, m|ake sure|
|00003e50| 0d 09 09 09 09 2f 2f 09 | 74 68 65 20 76 61 6c 75 |.....//.|the valu|
|00003e60| 65 20 68 61 73 20 61 63 | 74 75 61 6c 6c 79 20 63 |e has ac|tually c|
|00003e70| 68 61 6e 67 65 64 2e 2e | 2e 0d 09 09 09 09 69 66 |hanged..|......if|
|00003e80| 20 28 6f 6c 64 56 61 6c | 75 65 20 21 3d 20 67 41 | (oldVal|ue != gA|
|00003e90| 6d 70 6c 69 74 75 64 65 | 29 0d 09 09 09 09 09 67 |mplitude|)......g|
|00003ea0| 55 70 64 61 74 65 57 61 | 76 65 20 3d 20 74 72 75 |UpdateWa|ve = tru|
|00003eb0| 65 3b 0d 09 09 09 09 09 | 0d 09 09 09 09 62 72 65 |e;......|.....bre|
|00003ec0| 61 6b 3b 0d 0d 09 09 09 | 63 61 73 65 20 72 50 69 |ak;.....|case rPi|
|00003ed0| 74 63 68 42 75 74 74 6f | 6e 3a 0d 09 09 09 09 69 |tchButto|n:.....i|
|00003ee0| 66 20 28 70 61 72 74 20 | 3d 3d 20 69 6e 54 68 75 |f (part |== inThu|
|00003ef0| 6d 62 29 0d 09 09 09 09 | 09 54 72 61 63 6b 43 6f |mb).....|.TrackCo|
|00003f00| 6e 74 72 6f 6c 28 63 6f | 6e 74 72 6f 6c 2c 20 6d |ntrol(co|ntrol, m|
|00003f10| 6f 75 73 65 2c 20 6e 69 | 6c 29 3b 0d 09 09 09 09 |ouse, ni|l);.....|
|00003f20| 65 6c 73 65 0d 09 09 09 | 09 09 54 72 61 63 6b 43 |else....|..TrackC|
|00003f30| 6f 6e 74 72 6f 6c 28 63 | 6f 6e 74 72 6f 6c 2c 20 |ontrol(c|ontrol, |
|00003f40| 6d 6f 75 73 65 2c 20 28 | 50 72 6f 63 50 74 72 29 |mouse, (|ProcPtr)|
|00003f50| 53 63 72 6f 6c 6c 41 64 | 6a 75 73 74 29 3b 0d 09 |ScrollAd|just);..|
|00003f60| 09 09 09 6f 6c 64 56 61 | 6c 75 65 20 20 3d 20 67 |...oldVa|lue = g|
|00003f70| 50 69 74 63 68 3b 09 09 | 09 09 09 2f 2f 20 73 61 |Pitch;..|...// sa|
|00003f80| 76 65 20 70 69 74 63 68 | 20 76 61 6c 75 65 0d 09 |ve pitch| value..|
|00003f90| 09 09 09 67 50 69 74 63 | 68 20 3d 20 47 65 74 43 |...gPitc|h = GetC|
|00003fa0| 74 6c 56 61 6c 75 65 28 | 63 6f 6e 74 72 6f 6c 29 |tlValue(|control)|
|00003fb0| 3b 0d 09 09 09 09 0d 09 | 09 09 09 2f 2f 09 53 69 |;.......|...//.Si|
|00003fc0| 6e 63 65 20 72 65 63 61 | 6c 63 75 6c 61 74 69 6e |nce reca|lculatin|
|00003fd0| 67 20 74 68 65 20 77 61 | 76 65 20 66 6f 72 6d 20 |g the wa|ve form |
|00003fe0| 6d 61 79 20 74 61 6b 65 | 20 61 20 77 68 69 6c 65 |may take| a while|
|00003ff0| 2c 20 6d 61 6b 65 20 73 | 75 72 65 0d 09 09 09 09 |, make s|ure.....|
|00004000| 2f 2f 09 74 68 65 20 76 | 61 6c 75 65 20 68 61 73 |//.the v|alue has|
|00004010| 20 61 63 74 75 61 6c 6c | 79 20 63 68 61 6e 67 65 | actuall|y change|
|00004020| 64 2e 2e 2e 0d 09 09 09 | 09 69 66 20 28 6f 6c 64 |d.......|.if (old|
|00004030| 56 61 6c 75 65 20 21 3d | 20 67 41 6d 70 6c 69 74 |Value !=| gAmplit|
|00004040| 75 64 65 29 0d 09 09 09 | 09 09 67 55 70 64 61 74 |ude)....|..gUpdat|
|00004050| 65 57 61 76 65 20 3d 20 | 74 72 75 65 3b 0d 0d 09 |eWave = |true;...|
|00004060| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 7d 0d 09 7d |...break|;...}..}|
|00004070| 0d 7d 0d 0d 2f 2f 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.}..//~~|~~~~~~~~|
|00004080| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00004090| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000040a0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000040b0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000040c0| 7e 7e 7e 7e 7e 7e 0d 70 | 61 73 63 61 6c 20 76 6f |~~~~~~.p|ascal vo|
|000040d0| 69 64 20 53 63 72 6f 6c | 6c 41 64 6a 75 73 74 28 |id Scrol|lAdjust(|
|000040e0| 43 6f 6e 74 72 6f 6c 48 | 61 6e 64 6c 65 20 63 6f |ControlH|andle co|
|000040f0| 6e 74 72 6f 6c 2c 20 73 | 68 6f 72 74 20 70 61 72 |ntrol, s|hort par|
|00004100| 74 29 0d 7b 0d 09 73 68 | 6f 72 74 09 09 63 75 72 |t).{..sh|ort..cur|
|00004110| 56 61 6c 75 65 3b 0d 09 | 73 68 6f 72 74 09 09 6d |Value;..|short..m|
|00004120| 69 6e 56 61 6c 75 65 3b | 0d 09 73 68 6f 72 74 09 |inValue;|..short.|
|00004130| 09 6d 61 78 56 61 6c 75 | 65 3b 0d 0d 09 63 75 72 |.maxValu|e;...cur|
|00004140| 56 61 6c 75 65 20 3d 20 | 47 65 74 43 74 6c 56 61 |Value = |GetCtlVa|
|00004150| 6c 75 65 28 63 6f 6e 74 | 72 6f 6c 29 3b 0d 09 6d |lue(cont|rol);..m|
|00004160| 69 6e 56 61 6c 75 65 20 | 3d 20 47 65 74 43 74 6c |inValue |= GetCtl|
|00004170| 4d 69 6e 28 63 6f 6e 74 | 72 6f 6c 29 3b 0d 09 6d |Min(cont|rol);..m|
|00004180| 61 78 56 61 6c 75 65 20 | 3d 20 47 65 74 43 74 6c |axValue |= GetCtl|
|00004190| 4d 61 78 28 63 6f 6e 74 | 72 6f 6c 29 3b 0d 0d 09 |Max(cont|rol);...|
|000041a0| 73 77 69 74 63 68 20 28 | 70 61 72 74 29 20 7b 0d |switch (|part) {.|
|000041b0| 0d 09 09 63 61 73 65 20 | 69 6e 55 70 42 75 74 74 |...case |inUpButt|
|000041c0| 6f 6e 3a 0d 09 09 09 69 | 66 20 28 63 75 72 56 61 |on:....i|f (curVa|
|000041d0| 6c 75 65 20 3e 20 6d 69 | 6e 56 61 6c 75 65 29 0d |lue > mi|nValue).|
|000041e0| 09 09 09 09 53 65 74 43 | 74 6c 56 61 6c 75 65 28 |....SetC|tlValue(|
|000041f0| 63 6f 6e 74 72 6f 6c 2c | 20 63 75 72 56 61 6c 75 |control,| curValu|
|00004200| 65 20 2d 20 31 29 3b 0d | 09 09 09 62 72 65 61 6b |e - 1);.|...break|
|00004210| 3b 0d 09 09 63 61 73 65 | 20 69 6e 44 6f 77 6e 42 |;...case| inDownB|
|00004220| 75 74 74 6f 6e 3a 0d 09 | 09 09 69 66 20 28 63 75 |utton:..|..if (cu|
|00004230| 72 56 61 6c 75 65 20 3c | 20 6d 61 78 56 61 6c 75 |rValue <| maxValu|
|00004240| 65 29 0d 09 09 09 09 53 | 65 74 43 74 6c 56 61 6c |e).....S|etCtlVal|
|00004250| 75 65 28 63 6f 6e 74 72 | 6f 6c 2c 20 63 75 72 56 |ue(contr|ol, curV|
|00004260| 61 6c 75 65 20 2b 20 31 | 29 3b 0d 09 09 09 62 72 |alue + 1|);....br|
|00004270| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 69 6e 50 61 |eak;...c|ase inPa|
|00004280| 67 65 55 70 3a 0d 09 09 | 09 63 75 72 56 61 6c 75 |geUp:...|.curValu|
|00004290| 65 20 2d 3d 20 35 3b 0d | 09 09 09 69 66 20 28 63 |e -= 5;.|...if (c|
|000042a0| 75 72 56 61 6c 75 65 20 | 3c 20 6d 69 6e 56 61 6c |urValue |< minVal|
|000042b0| 75 65 29 0d 09 09 09 09 | 63 75 72 56 61 6c 75 65 |ue).....|curValue|
|000042c0| 20 3d 20 6d 69 6e 56 61 | 6c 75 65 3b 0d 09 09 09 | = minVa|lue;....|
|000042d0| 69 66 20 28 63 75 72 56 | 61 6c 75 65 20 3e 3d 20 |if (curV|alue >= |
|000042e0| 6d 69 6e 56 61 6c 75 65 | 29 0d 09 09 09 09 53 65 |minValue|).....Se|
|000042f0| 74 43 74 6c 56 61 6c 75 | 65 28 63 6f 6e 74 72 6f |tCtlValu|e(contro|
|00004300| 6c 2c 20 63 75 72 56 61 | 6c 75 65 29 3b 0d 09 09 |l, curVa|lue);...|
|00004310| 09 62 72 65 61 6b 3b 0d | 09 09 63 61 73 65 20 69 |.break;.|..case i|
|00004320| 6e 50 61 67 65 44 6f 77 | 6e 3a 0d 09 09 09 63 75 |nPageDow|n:....cu|
|00004330| 72 56 61 6c 75 65 20 2b | 3d 20 35 3b 0d 09 09 09 |rValue +|= 5;....|
|00004340| 69 66 20 28 63 75 72 56 | 61 6c 75 65 20 3e 20 6d |if (curV|alue > m|
|00004350| 61 78 56 61 6c 75 65 29 | 0d 09 09 09 09 63 75 72 |axValue)|.....cur|
|00004360| 56 61 6c 75 65 20 3d 20 | 6d 61 78 56 61 6c 75 65 |Value = |maxValue|
|00004370| 3b 0d 09 09 09 69 66 20 | 28 63 75 72 56 61 6c 75 |;....if |(curValu|
|00004380| 65 20 3c 3d 20 6d 61 78 | 56 61 6c 75 65 29 0d 09 |e <= max|Value)..|
|00004390| 09 09 09 53 65 74 43 74 | 6c 56 61 6c 75 65 28 63 |...SetCt|lValue(c|
|000043a0| 6f 6e 74 72 6f 6c 2c 20 | 63 75 72 56 61 6c 75 65 |ontrol, |curValue|
|000043b0| 29 3b 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 7d 0d |);....br|eak;..}.|
|000043c0| 0d 7d 0d 0d 2f 2f 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |.}..//~~|~~~~~~~~|
|000043d0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000043e0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|000043f0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00004400| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00004410| 7e 7e 7e 7e 7e 7e 0d 43 | 6f 6e 74 72 6f 6c 48 61 |~~~~~~.C|ontrolHa|
|00004420| 6e 64 6c 65 20 46 69 6e | 64 4d 79 43 6f 6e 74 72 |ndle Fin|dMyContr|
|00004430| 6f 6c 28 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |ol(Windo|wPtr win|
|00004440| 64 6f 77 2c 20 73 68 6f | 72 74 20 63 6e 74 6c 52 |dow, sho|rt cntlR|
|00004450| 65 66 43 6f 6e 29 0d 7b | 0d 09 43 6f 6e 74 72 6f |efCon).{|..Contro|
|00004460| 6c 48 61 6e 64 6c 65 09 | 09 63 6e 74 6c 48 61 6e |lHandle.|.cntlHan|
|00004470| 64 6c 65 3b 0d 0d 09 63 | 6e 74 6c 48 61 6e 64 6c |dle;...c|ntlHandl|
|00004480| 65 20 3d 20 28 28 57 69 | 6e 64 6f 77 50 65 65 6b |e = ((Wi|ndowPeek|
|00004490| 29 28 77 69 6e 64 6f 77 | 29 29 2d 3e 63 6f 6e 74 |)(window|))->cont|
|000044a0| 72 6f 6c 4c 69 73 74 3b | 0d 09 77 68 69 6c 65 20 |rolList;|..while |
|000044b0| 28 63 6e 74 6c 48 61 6e | 64 6c 65 20 21 3d 20 6e |(cntlHan|dle != n|
|000044c0| 69 6c 29 20 7b 0d 09 09 | 69 66 20 28 47 65 74 43 |il) {...|if (GetC|
|000044d0| 52 65 66 43 6f 6e 28 63 | 6e 74 6c 48 61 6e 64 6c |RefCon(c|ntlHandl|
|000044e0| 65 29 20 21 3d 20 63 6e | 74 6c 52 65 66 43 6f 6e |e) != cn|tlRefCon|
|000044f0| 29 0d 09 09 09 63 6e 74 | 6c 48 61 6e 64 6c 65 20 |)....cnt|lHandle |
|00004500| 3d 20 28 2a 2a 63 6e 74 | 6c 48 61 6e 64 6c 65 29 |= (**cnt|lHandle)|
|00004510| 2e 6e 65 78 74 43 6f 6e | 74 72 6f 6c 3b 0d 09 09 |.nextCon|trol;...|
|00004520| 65 6c 73 65 0d 09 09 09 | 62 72 65 61 6b 3b 0d 09 |else....|break;..|
|00004530| 7d 0d 09 72 65 74 75 72 | 6e 20 28 63 6e 74 6c 48 |}..retur|n (cntlH|
|00004540| 61 6e 64 6c 65 29 3b 0d | 7d 0d 0d 0d 00 00 00 00 |andle);.|}.......|
|00004550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004580| 00 00 01 00 00 00 03 04 | 00 00 02 04 00 00 00 5e |........|.......^|
|00004590| 00 00 10 62 00 00 00 0c | 05 00 00 00 10 6a 00 00 |...b....|.....j..|
|000045a0| 02 a4 05 00 00 00 10 6e | 00 00 00 11 05 00 00 00 |.......n|........|
|000045b0| 09 4d 61 69 6e 41 70 70 | 2e 63 02 00 00 00 54 45 |.MainApp|.c....TE|
|000045c0| 58 54 4d 50 53 20 01 00 | ff ff ff ff 00 00 00 00 |XTMPS ..|........|
|000045d0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 ff ff ff ff |..TEXTMP|S ......|
|000045e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000045f0| 00 00 a4 29 3b 56 00 00 | 44 cc 00 00 03 62 00 00 |...);V..|D....b..|
|00004600| 11 3c 00 00 00 1f 05 00 | 00 00 11 51 00 00 02 a9 |.<......|...Q....|
|00004610| 05 00 00 00 11 61 00 00 | 02 d1 05 00 00 00 11 de |.....a..|........|
|00004620| 00 00 00 09 05 00 00 00 | 11 eb 00 00 00 64 05 00 |........|.....d..|
|00004630| 00 00 11 f1 00 00 02 aa | 05 00 00 00 11 f3 00 00 |........|........|
|00004640| 00 63 05 00 00 00 12 64 | 00 00 00 82 05 00 00 00 |.c.....d|........|
|00004650| 13 16 00 00 00 83 05 00 | 00 00 13 1a 00 00 00 88 |........|........|
|00004660| 05 00 00 00 13 1e 00 00 | 00 8a 05 00 00 00 13 22 |........|......."|
|00004670| 00 00 00 8c 05 00 00 00 | 13 26 00 00 00 8d 00 00 |........|.&......|
|00004680| 00 00 00 0a 00 00 0a 94 | 00 63 00 00 00 00 00 00 |........|.c......|
|00004690| 00 48 00 09 4d 6f 6e 61 | 63 6f 00 00 00 00 00 00 |.H..Mona|co......|
|000046a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000046b0| 00 00 00 00 00 06 00 04 | 00 3c 00 24 03 61 02 62 |........|.<.$.a.b|
|000046c0| 00 3c 00 24 03 61 02 62 | a6 6f ba e0 00 00 2f 80 |.<.$.a.b|.o..../.|
|000046d0| 00 00 2f 80 00 00 2e 4f | 01 00 00 00 01 7a 00 13 |../....O|.....z..|
|000046e0| 00 00 17 fe 00 00 18 09 | 0b 41 64 6a 75 73 74 4d |........|.AdjustM|
|000046f0| 65 6e 75 73 00 00 31 84 | 00 00 31 8d 09 41 6c 65 |enus..1.|..1..Ale|
|00004700| 72 74 55 73 65 72 00 00 | 13 dc 00 00 13 e6 0b 44 |rtUser..|.......D|
|00004710| 6f 41 63 74 69 76 61 74 | 65 00 00 00 22 4f 00 00 |oActivat|e..."O..|
|00004720| 22 5c 0d 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 |"\.DoClo|seWindow|
|00004730| 00 00 14 ad 00 00 14 bb | 0f 44 6f 43 6f 6e 74 65 |........|.DoConte|
|00004740| 6e 74 43 6c 69 63 6b 00 | 00 00 0b 21 00 00 0b 28 |ntClick.|...!...(|
|00004750| 07 44 6f 45 76 65 6e 74 | 00 00 2e 42 00 00 2e 48 |.DoEvent|...B...H|
|00004760| 07 44 6f 49 64 6c 65 00 | 00 00 1b 4e 00 00 1b 5b |.DoIdle.|...N...[|
|00004770| 0d 44 6f 4d 65 6e 75 43 | 6f 6d 6d 61 6e 64 00 00 |.DoMenuC|ommand..|
|00004780| 12 22 00 00 12 2a 09 44 | 6f 55 70 64 61 74 65 00 |."...*.D|oUpdate.|
|00004790| 00 00 38 1f 00 00 38 2d | 0f 44 72 61 77 4d 61 69 |..8...8-|.DrawMai|
|000047a0| 6e 57 69 6e 64 6f 77 00 | 00 00 0a 28 00 00 0a 31 |nWindow.|...(...1|
|000047b0| 09 45 76 65 6e 74 4c 6f | 6f 70 00 00 30 9a 00 00 |.EventLo|op..0...|
|000047c0| 30 a7 0d 46 61 69 6c 4c | 6f 77 4d 65 6d 6f 72 79 |0..FailL|owMemory|
|000047d0| 00 00 2d 8e 00 00 2d 96 | 09 47 65 74 53 6c 65 65 |..-...-.|.GetSlee|
|000047e0| 70 00 00 00 24 f2 00 00 | 24 fc 0b 49 6e 69 74 69 |p...$...|$..Initi|
|000047f0| 61 6c 69 7a 65 00 00 00 | 2c 19 00 00 2c 23 0b 49 |alize...|,...,#.I|
|00004800| 73 44 41 57 69 6e 64 6f | 77 00 00 00 07 ef 00 00 |sDAWindo|w.......|
|00004810| 07 f3 05 6d 61 69 6e 00 | 00 00 3b 2f 00 00 3b 3e |...main.|..;/..;>|
|00004820| 0f 4d 61 69 6e 57 69 6e | 64 6f 77 43 6c 69 63 6b |.MainWin|dowClick|
|00004830| 00 00 33 97 00 00 33 a4 | 0d 4e 65 77 4d 61 69 6e |..3...3.|.NewMain|
|00004840| 57 69 6e 64 6f 77 00 00 | 23 83 00 00 23 8c 09 54 |Window..|#...#..T|
|00004850| 65 72 6d 69 6e 61 74 65 | 00 00 00 28 00 3c 00 24 |erminate|...(.<.$|
|00004860| 03 61 02 62 00 3c 00 24 | 03 61 02 62 00 00 2e 4f |.a.b.<.$|.a.b...O|
|00004870| 02 00 00 00 00 77 00 00 | 02 77 00 00 00 00 00 00 |.....w..|.w......|
|00004880| 00 00 00 00 00 00 01 00 | 00 00 03 04 00 00 02 04 |........|........|
|00004890| 00 00 00 5e 00 8e 1e 5c | 09 30 00 00 00 1c 00 5e |...^...\|.0.....^|
|000048a0| 00 01 4d 50 53 52 00 02 | 00 12 42 4b 50 54 00 00 |..MPSR..|..BKPT..|
|000048b0| 00 36 03 ed ff ff 00 00 | 00 0e 00 00 00 00 03 ef |.6......|........|
|000048c0| ff ff 00 00 00 5a 00 00 | 00 00 03 f0 ff ff 00 00 |.....Z..|........|
|000048d0| 01 d8 00 94 1b ac 49 7f | ff ff 00 00 00 00 00 00 |......I.|........|
|000048e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000048f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+